plint

French poetry validator (local mirror of https://gitlab.com/a3nm/plint)
git clone https://a3nm.net/git/plint/
Log | Files | Refs | README

commit 2bd9df4ef0eea5b0e62de57eb82ec671872533f1
parent a35a8ab59de07caeb6c8742fa8439412591dbe49
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sun, 27 Jul 2014 15:16:52 +0200

elision inside words ("porte-avion")

Diffstat:
verse.py | 6++++++
versetest.py | 5+++++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/verse.py b/verse.py @@ -146,6 +146,12 @@ class Verse: if w[i+1]['text'][1] in "eéèa": w[i+1]['text'] = w[i+1]['text'][1:] + # elide inside words ("porte-avions") + for word in self.chunks: + for i, w in enumerate(word[:-1]): + if w['text'] == "e-": + w['weights'] = [0] # force elision + # remove leading and trailing crap for w in self.chunks: for p in range(len(w)): diff --git a/versetest.py b/versetest.py @@ -129,6 +129,11 @@ class ExceptionCounts(Counts): self.assertEqual(1, len(f)) self.assertEqual(self.getWeight(f[0]), 8) + def testPorteAvions(self): + f = self.runCount("porte-avions porte-avions", limit=6) + self.assertEqual(1, len(f)) + self.assertEqual(self.getWeight(f[0]), 6) + class AspiratedCounts(Counts): def testBaudelaire1half(self): possible = self.runCount("funeste hélas", limit=4)