реализована функция clear_text

This commit is contained in:
Максим Гетман 2026-04-22 16:54:42 +03:00
parent 3f3b3fc630
commit 8ae04ec651
2 changed files with 16 additions and 5 deletions

View File

@ -1,3 +1,3 @@
1;5;good job
2;5;nice price
3;5;super work
1;5;gOOd Job
2;5;niCe pRIcE
3;5;sUPer worKk
1 1 5 good job gOOd Job
2 2 5 nice price niCe pRIcE
3 3 5 super work sUPer worKk

15
main.py
View File

@ -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):