From 2cc926aea16d915ebd551e64995f0ce72136a49a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mare=C4=8Dek?= Date: Thu, 19 Sep 2024 15:01:09 +0200 Subject: [PATCH] osetreno aby to nepadalo v mistech, kde je posledni slovo verse neslabicne --- kveta/rhyme.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kveta/rhyme.py b/kveta/rhyme.py index f84eb20..7760d07 100644 --- a/kveta/rhyme.py +++ b/kveta/rhyme.py @@ -1,6 +1,7 @@ import re from rhymeTagger import RhymeTagger import os +import sys class RhymeDetection: @@ -73,7 +74,10 @@ def tag(self, poem): break # nyní označujeme začátky rýmujících se částí for l in c: - if not exists_monosyllabic_word and len(poem[l]["words"][-1]["syllables"]) >= 2: # víceslabičné slovo + if not poem[l]["words"][-1]["syllables"]: + # poslední slovo je neslabičné + print("INFO: the last word in line is non-syllabic", file=sys.stderr) + elif not exists_monosyllabic_word and len(poem[l]["words"][-1]["syllables"]) >= 2: # víceslabičné slovo poem[l]["words"][-1]["syllables"][-2]["rhyme_from"] = 'v' poem[l]["words"][-1]["syllables"][-1]["rhyme_from"] = 'c' elif not exists_monosyllabic_word and len(poem[l]["words"]) >= 2 and poem[l]["words"][-2]["vec"] and poem[l]["words"][-2]["vec"]["prep"][0] == 1: # jednoslabičné slovo za slabičkou předložkou