From 8ae04ec651ec4336a8f927383fd810a92d803898 Mon Sep 17 00:00:00 2001 From: stud203799 Date: Wed, 22 Apr 2026 16:54:42 +0300 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B0=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8?= =?UTF-8?q?=D1=8F=20clear=5Ftext?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data.csv | 6 +++--- main.py | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) 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):