From 0a8e192789ff60adbd04b986dad2a2b59ff731c7 Mon Sep 17 00:00:00 2001 From: Aleksey Filippov Date: Wed, 31 May 2023 00:05:00 +0400 Subject: [PATCH] Remove spec symbols --- src/syntax.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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))