Skip to content
Snippets Groups Projects
Commit a29906d7 authored by Simon Will's avatar Simon Will
Browse files

Fix two bugs concerning vowels in scanner

parent f464eec0
No related branches found
No related tags found
No related merge requests found
......@@ -209,7 +209,7 @@ def get_syllables_for_accented_form(token):
syll_vowel_length = 1
syll_has_vowel = False
for i, c in enumerate(chunks):
if c[0] in 'aeiouy':
if c[0] in 'AEIOUYaeiouy':
if syll_has_vowel:
# Syllable already has a vowel.
# Add the current syllable and begin a new one.
......@@ -229,7 +229,7 @@ def get_syllables_for_accented_form(token):
syll_text += c.rstrip('_^')
syll_has_vowel = True
syll_vowel_length = (
2 if len(c) > 1 and c[1] in 'aeiouy_' else 1
2 if len(c) > 1 and c[1] in 'AEIOUYaeiouy_' else 1
)
else:
syll_text += c.rstrip('_^')
......@@ -388,7 +388,7 @@ def get_syllables(reading):
def muta_cum_liquida(verse):
mcl_regex = re.compile(
r'[aeiouv](([bpsckgdt]|(qu)|(qv))\W*[lrmn])([aeiouv]|[.?!]|$)',
r'[aeiouvy](([bpsckgdt]|(qu)|(qv))\W*[lrmn])([aeiouvy]|[.?!]|$)',
flags=re.IGNORECASE
)
if re.search(mcl_regex, verse.text):
......@@ -406,7 +406,7 @@ def muta_cum_liquida(verse):
def positional_lengthening(verse):
pl_regex = re.compile(
r'[aeiouv](((([bcdfgjklmnprstvwxz]h?|(qu))\W*){2,})|[xz])',
r'[aeiouvy](((([bcdfgjklmnprstvwxz]h?|(qu))\W*){2,})|[xz])',
flags=re.IGNORECASE
)
for match in re.finditer(pl_regex, verse.text):
......@@ -439,9 +439,11 @@ def make_elisions(verse):
# Break the for and continue with the next reading.
break
m = re.search(r'[aeiouy][mh]*$', this_syllable.text)
m = re.search(r'[aeiouy][mh]*$', this_syllable.text,
flags=re.IGNORECASE)
if m:
if re.search(r'^h?[aeiouy]', next_syllable.text):
if re.search(r'^h?[aeiouy]', next_syllable.text,
flags=re.IGNORECASE):
# Elision!
elision = Phenomenon(omitted=m.group())
this_syllable.phenomena['elision'] = elision
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment