Skip to content

Commit

Permalink
osetreno aby to nepadalo v mistech, kde je posledni slovo verse
Browse files Browse the repository at this point in the history
neslabicne
  • Loading branch information
davidmarecek committed Sep 19, 2024
1 parent 76f2e33 commit 2cc926a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kveta/rhyme.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import re
from rhymeTagger import RhymeTagger
import os
import sys

class RhymeDetection:

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2cc926a

Please sign in to comment.