исправление работы списков слов

This commit is contained in:
2025-10-13 14:05:47 +03:00
parent 1d32ec94e5
commit ab10879c06
2 changed files with 13 additions and 5 deletions

View File

@@ -112,13 +112,17 @@ def contains_bad_word(text: str) -> bool:
# Приводим к нижнему регистру для проверки
text_lower = text.lower()
# Получаем актуальные списки из кэша
bad_words = get_bad_words()
exceptions = get_exceptions()
# Проверяем исключения
for exception in EXCEPTIONS:
for exception in exceptions:
if exception in text_lower:
text_lower = text_lower.replace(exception, '')
# Проверяем бранные слова
for bad_word in BAD_WORDS:
for bad_word in bad_words:
if bad_word in text_lower:
return True
@@ -140,13 +144,17 @@ def get_bad_words_from_text(text: str) -> list:
text_lower = text.lower()
found_words = []
# Получаем актуальные списки из кэша
bad_words = get_bad_words()
exceptions = get_exceptions()
# Проверяем исключения
for exception in EXCEPTIONS:
for exception in exceptions:
if exception in text_lower:
text_lower = text_lower.replace(exception, '')
# Ищем бранные слова
for bad_word in BAD_WORDS:
for bad_word in bad_words:
if bad_word in text_lower:
found_words.append(bad_word)