Skip to content

Commit

Permalink
improved breathing_check in presence of diaeresis
Browse files Browse the repository at this point in the history
  • Loading branch information
jtauber committed Oct 19, 2019
1 parent 66145d5 commit 840b350
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion greek_normalisation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
PSILI = "\u0313"
DASIA = "\u0314"

DIAERESIS = "\u0308"

BREATHING = [PSILI, DASIA]
ACCENTS = [VARIA, OXIA, PERISPOMENI]

Expand Down Expand Up @@ -69,7 +71,10 @@ def breathing_check(word):
if len(d) > 1:
if d[1] in BREATHING:
if len(d) > 2 and d[2] in "ιυ":
return False
if len(d) > 3 and d[3] == DIAERESIS:
return True
else:
return False
else:
return True
elif d[1] in "ιυ":
Expand Down
3 changes: 3 additions & 0 deletions tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ False
>>> breathing_check('ἀι')
False

>>> breathing_check('ἀϊ')
True

>>> breathing_check('ἀε')
True

Expand Down

0 comments on commit 840b350

Please sign in to comment.