plint

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

commit bfe546196b2573fcc725db00a61c8613ed7b5964
parent 3e193b33dd7dee79d9db366c317c0c2014a4da6c
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sat,  8 Dec 2012 22:34:59 +0100

add support for single-syllable words at end of verse

Diffstat:
metric.py | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/metric.py b/metric.py @@ -71,6 +71,14 @@ def fit(chunks, pos, left, diaeresis): def feminine(align, verse, phon): for a in sure_end_fem: if verse.endswith(a): + # check that this isn't a one-syllabe wourd + for i in range(4): + for j in ' -': + try: + if j in align[-i-1]: + return ['M', 'F'] + except IndexError: + return ['M', 'F'] return ['F'] if not verse.endswith('ent'): return ['M']