diff --git a/data.csv b/data.csv index 1c910ec..d5e8998 100644 --- a/data.csv +++ b/data.csv @@ -1,3 +1,3 @@ -1;5;good job -2;5;nice price -3;5;super work \ No newline at end of file +1;5;gOOd Job +2;5;niCe pRIcE +3;5;sUPer worKk \ No newline at end of file diff --git a/main.py b/main.py index d217806..3c9b84c 100644 --- a/main.py +++ b/main.py @@ -1,8 +1,19 @@ # Система анализа и модерации отзывов на товары (E-Commerce Review Engine) def clean_text(text: str): - - return str + text = "1;5;?П:::р?И,,вЕт! ДуРг." + black_list = ",?:" + if text[3] == ';': + start_text = text[:5] + text = text[4:] + for i in range(len(black_list)): + text = text.replace(black_list[i], '') + text = text.lower() + for i in range(len(text)): + text = text.replace(' ', ' ') + return text + else: + print("Некорректный ввод текста отзыва") def extract_keywords(text: str, keywords_dict: dict):