fix(dictionary): strip Latin romanization debris from Russian translations and sanitize dictionary cache

This commit is contained in:
2026-10-06 23:08:54 +03:00
parent e371cdd4e5
commit 52db766b23
7 changed files with 109 additions and 27 deletions
+20
View File
@@ -2027,6 +2027,26 @@ def test_sentence_dictionary_hints_and_fauna_precision():
assert "large" in prompt
def test_clean_russian_translation_removes_romanization():
from app.dictionary import clean_russian_translation
raw_flutter = "трепет, порхание, развеваться át’sjaпорхать át’/, бить крыльями ’ krýl’jamiмахать крыльями át’ krýl’jami/"
clean_flutter = clean_russian_translation(raw_flutter)
assert clean_flutter == "трепет, порхание, развеваться, порхать, бить крыльями, махать крыльями"
assert "át’sja" not in clean_flutter
assert "krýl’jami" not in clean_flutter
assert "/" not in clean_flutter
raw_tawny = "рыжевато-коричневый, рыжевато-коричневый ževáto-koríčnevyj/"
clean_tawny = clean_russian_translation(raw_tawny)
assert clean_tawny == "рыжевато-коричневый"
raw_like = "подобный, похожий óžij/, как, типа ípa/"
clean_like = clean_russian_translation(raw_like)
assert clean_like == "подобный, похожий, как, типа"