commit e69e14d18af5b8f3b7fbb28d1d32ef38f27a77ad
parent 6427c2151cef97e1778482758a4b7951f44ce056
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Thu, 26 Dec 2013 17:53:45 +0100
fixes
Diffstat:
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/verse.py b/verse.py
@@ -257,7 +257,7 @@ class Verse:
# collapse words
self.chunks = sum(self.chunks, [])
- def parse(self):
+ def annotate(self):
# annotate weights
for i, chunk in enumerate(self.chunks):
if (not is_vowels(self.chunks[i]['text'])):
@@ -267,6 +267,9 @@ class Verse:
self.chunks[i]['weights'] = self.possible_weights_context(i)
self.chunks[i]['hemis'] = self.hemistiche(i)
+ def parse(self):
+ self.annotate()
+
self.possible = self.fit(0, 0, self.pattern.hemistiches)
self.text = self.align2str(self.chunks)
@@ -324,10 +327,10 @@ class Verse:
return [0 if x else 1 for x in self.chunks[pos]['elidable']]
return self.possible_weights(pos)
- def feminine(self, align):
+ def feminine(self, align=None):
for a in sure_end_fem:
if self.text.endswith(a):
- # check that this isn't a one-syllabe wourd
+ # check that this isn't a one-syllabe word
for i in range(4):
try:
if '-' in self.chunks[-i-1]['text'] or 'wordend' in self.chunks[-i-1]:
@@ -338,6 +341,8 @@ class Verse:
if not self.text.endswith('ent'):
return ['M']
# verse ends with 'ent'
+ if not align:
+ return ['M', 'F']
if align and align[-2]['weight'] == 0:
return ['F'] # mute -ent
if align and align[-2]['weight'] > 0 and align[-2]['text'] == 'e':