plint

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

commit d50b9e9d75f58ede2eaf40cf972472ebf3f34e77
parent a19d27a03dfc2b2aceae361154269549c4191fd9
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sat, 10 Aug 2019 23:14:10 +0200

refactoring

Diffstat:
TODO | 3+++
verse.py | 11+++++++----
2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/TODO b/TODO @@ -1,3 +1,6 @@ +- le h non aspiré fait hiatus +- "et" suivi d'une voyelle fait hiatus + ./train_diaeresis.sh does not correctly handle "oublieux" despite many occurrences in additions, what is going on? diff --git a/verse.py b/verse.py @@ -28,6 +28,12 @@ letters = { 'z': 'zaide' } +def elision_wrap(w): + first_letter = common.rm_punct(w[0]['original'].strip()) + return elision(''.join(x['text'] for x in w), + ''.join(x['original'] for x in w), + first_letter == first_letter.upper()) + def elision(word, original_word, was_cap): if word.startswith('y'): if word == 'y': @@ -256,10 +262,7 @@ class Verse: # vowel elision problems for w in self.chunks: if 'elision' not in w[0].keys(): - first_letter = common.rm_punct(w[0]['original'].strip()) - w[0]['elision'] = elision(''.join(x['text'] for x in w), - ''.join(x['original'] for x in w), - first_letter == first_letter.upper()) + w[0]['elision'] = elision_wrap(w) # case of 'y' ys_regexp = re.compile("(y+)")