commit 87bb1f084bdf2189b0f91fb31166aec84fecf1bb
parent d51d134cbaea402fcacd1cd1734f1f9690386258
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Sun, 6 Sep 2015 22:28:08 +0200
sure_fem in single syllable still fem if vowel precedes
Diffstat:
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/verse.py b/verse.py
@@ -423,6 +423,12 @@ class Verse:
def feminine(self, align=None):
for a in sure_end_fem:
if self.text.endswith(a):
+ # if vowel before, it must be fem
+ try:
+ if self.text[-len(a)-1] in common.vowels:
+ return ['F']
+ except IndexError:
+ return ['M', 'F']
# check that this isn't a one-syllabe word
for i in range(4):
try:
diff --git a/versetest.py b/versetest.py
@@ -189,6 +189,15 @@ class PoemCounts(Counts):
possible = self.runCount(self.v3, limit="6/6")
self.assertTrue(self.achievesPossibility(possible, 12))
+class SanityCheck(unittest.TestCase):
+ def testSimple(self):
+ text = "Patati patata patata tata vies"
+ v = verse.Verse(text, template.Template(), template.Pattern("12"))
+ v.parse()
+ gend = v.genders()
+ self.assertEqual(1, len(gend))
+ self.assertEqual('F', next(iter(gend)))
+
if __name__ == "__main__":
diaeresis.load_diaeresis('diaeresis.json')
unittest.main()