Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1214,7 +1214,7 @@ def extract_failed_checks(checks_dict, exceptions_dict, context=""):
|
|
1214 |
pair = (l_o, l_m)
|
1215 |
exceptions_dict.setdefault("dates_written_out", set()).add(pair)
|
1216 |
|
1217 |
-
elif rule_key == "
|
1218 |
# reason: "Не пройдена проверка на повторы слов: зачисление"
|
1219 |
match = re.search(r'повторы слов:\s*(\S+)', reason, re.IGNORECASE)
|
1220 |
if match:
|
@@ -1250,7 +1250,7 @@ def rule_to_str(rule_key):
|
|
1250 |
"derived_prepositions": "Производные предлоги",
|
1251 |
"compound_sentences": "Сложноподчиненные предложения",
|
1252 |
"dates_written_out": "Даты прописью",
|
1253 |
-
"
|
1254 |
}
|
1255 |
return translation.get(rule_key, rule_key)
|
1256 |
|
@@ -1804,7 +1804,7 @@ def check_no_dates_written_out(message, exceptions=None):
|
|
1804 |
|
1805 |
# Доп правило. Повторы слов
|
1806 |
|
1807 |
-
def
|
1808 |
"""
|
1809 |
Проверка на повторы слов (кроме определённых частей речи).
|
1810 |
Если lemma есть в exceptions['word_repetitions'], пропускаем.
|
@@ -1856,6 +1856,7 @@ NON_CRITICAL_CHECKS = [
|
|
1856 |
"adverbial_participles",
|
1857 |
"superlative_adjectives",
|
1858 |
"passive_voice",
|
|
|
1859 |
"repeating_conjunctions",
|
1860 |
"amplifiers",
|
1861 |
"time_parasites",
|
@@ -2021,7 +2022,7 @@ def perform_checks(message, key_message, exceptions_dict=None):
|
|
2021 |
"derived_prepositions": safe_check(lambda msg, km: check_no_derived_prepositions(msg, exceptions_dict), message),
|
2022 |
"compound_sentences": safe_check(lambda msg, km: check_no_compound_sentences(msg, exceptions_dict), message),
|
2023 |
"dates_written_out": safe_check(lambda msg, km: check_no_dates_written_out(msg, exceptions_dict), message),
|
2024 |
-
"
|
2025 |
}
|
2026 |
|
2027 |
print(f"[DEBUG perform_checks] message={repr(message)} key_message={repr(key_message)}\n"
|
@@ -2052,7 +2053,7 @@ def format_checks(checks):
|
|
2052 |
"derived_prepositions": "Производные предлоги",
|
2053 |
"compound_sentences": "Сложноподчиненные предложения",
|
2054 |
"dates_written_out": "Даты прописью",
|
2055 |
-
"
|
2056 |
}
|
2057 |
|
2058 |
critical_lines = []
|
|
|
1214 |
pair = (l_o, l_m)
|
1215 |
exceptions_dict.setdefault("dates_written_out", set()).add(pair)
|
1216 |
|
1217 |
+
elif rule_key == "word_repetitions":
|
1218 |
# reason: "Не пройдена проверка на повторы слов: зачисление"
|
1219 |
match = re.search(r'повторы слов:\s*(\S+)', reason, re.IGNORECASE)
|
1220 |
if match:
|
|
|
1250 |
"derived_prepositions": "Производные предлоги",
|
1251 |
"compound_sentences": "Сложноподчиненные предложения",
|
1252 |
"dates_written_out": "Даты прописью",
|
1253 |
+
"word_repetitions": "Повторы слов",
|
1254 |
}
|
1255 |
return translation.get(rule_key, rule_key)
|
1256 |
|
|
|
1804 |
|
1805 |
# Доп правило. Повторы слов
|
1806 |
|
1807 |
+
def check_word_repetitions(message, key_message, exceptions=None):
|
1808 |
"""
|
1809 |
Проверка на повторы слов (кроме определённых частей речи).
|
1810 |
Если lemma есть в exceptions['word_repetitions'], пропускаем.
|
|
|
1856 |
"adverbial_participles",
|
1857 |
"superlative_adjectives",
|
1858 |
"passive_voice",
|
1859 |
+
"written_out_ordinals",
|
1860 |
"repeating_conjunctions",
|
1861 |
"amplifiers",
|
1862 |
"time_parasites",
|
|
|
2022 |
"derived_prepositions": safe_check(lambda msg, km: check_no_derived_prepositions(msg, exceptions_dict), message),
|
2023 |
"compound_sentences": safe_check(lambda msg, km: check_no_compound_sentences(msg, exceptions_dict), message),
|
2024 |
"dates_written_out": safe_check(lambda msg, km: check_no_dates_written_out(msg, exceptions_dict), message),
|
2025 |
+
"word_repetitions": safe_check(lambda msg, km: check_word_repetitions(msg, km, exceptions_dict), message, key_message),
|
2026 |
}
|
2027 |
|
2028 |
print(f"[DEBUG perform_checks] message={repr(message)} key_message={repr(key_message)}\n"
|
|
|
2053 |
"derived_prepositions": "Производные предлоги",
|
2054 |
"compound_sentences": "Сложноподчиненные предложения",
|
2055 |
"dates_written_out": "Даты прописью",
|
2056 |
+
"word_repetitions": "Повторы слов"
|
2057 |
}
|
2058 |
|
2059 |
critical_lines = []
|