plint

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

commit 3a82a9fc76d87774d3c104d228379b40967be5a7
parent 0d655d2f8408074bbfd4b5ed26ca371e14cbc954
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sun, 10 Jun 2012 18:46:42 +0200

fix: -i and -ï are acceptable eye rhymes

Diffstat:
rhyme.py | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/rhyme.py b/rhyme.py @@ -27,6 +27,10 @@ liaison = { 'z': 'z', } +tolerance = { + 'ï': 'i' + } + class Constraint: def __init__(self, classical, phon): @@ -123,7 +127,13 @@ def suffix(x, y): """length of the longest common suffix of x and y""" bound = min(len(x), len(y)) for i in range(bound): - if x[-(1+i)] != y[-(1+i)]: + a = x[-(1+i)] + b = y[-(1+i)] + if a in tolerance.keys(): + a = tolerance[a] + if b in tolerance.keys(): + b = tolerance[b] + if a != b: return i return bound