Skip to content

Commit 84feb91

Browse files
committed
Fix serious bug + add new test against it
1 parent a090f08 commit 84feb91

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

russian_text_stresser/russian_dictionary.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ def write_stressed_word(word: str, stressed_dict_word: str):
287287
# This is needed because some canonical words are incorrect in the database
288288
if char == "ё" or char == "Ё":
289289
yo_in_wrd = word[index]
290-
if yo_in_wrd == "е":
290+
if yo_in_wrd == "е" or yo_in_wrd == "ё":
291291
result_word += "ё"
292-
elif yo_in_wrd == "Е":
292+
elif yo_in_wrd == "Е" or yo_in_wrd == "Ё":
293293
result_word += "Ё"
294294
index += 1
295295
elif char != "\u0301":

russian_text_stresser/word_stress_tests.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ def test_bylo(self):
5959
self.assertEqual(
6060
self.stresser.stress_text("Это было давно."), "Э́то бы́ло давно́."
6161
)
62+
63+
def test_yo_retaining(self):
64+
self.assertEqual(
65+
self.stresser.stress_text("Значит, спорить по этому поводу совершенно ни к чему, — твёрдо заключил Гарри."),
66+
"Зна́чит, спо́рить по э́тому по́воду соверше́нно ни к чему́, — твёрдо заключи́л Га́рри.",
67+
)
6268

6369
# SO FAR FAILING TESTS
6470
def test_vselennaya(self):

0 commit comments

Comments
 (0)