diff --git a/src/syntax.py b/src/syntax.py index 62a3d06..dd79088 100644 --- a/src/syntax.py +++ b/src/syntax.py @@ -1,3 +1,4 @@ +import re from typing import Final import requests @@ -7,6 +8,7 @@ from src.parse_tree.parse_tree import ParseTree class Syntax: __server: Final[str] = 'http://syntaxnet.athene.tech' + __regex = re.compile('[^a-zA-Zа-яА-Я ]') def __parsey(self, text): print(f'Connecting to \'{self.__server}\'...') @@ -23,4 +25,5 @@ class Syntax: return result def get_parse_tree(self, text: str) -> ParseTree: - return ParseTree(self.__parsey(text)) + prepared_text: str = self.__regex.sub('', str(text)) + return ParseTree(self.__parsey(prepared_text))