neburnodrog / Pyverse

A syllabification algorithm for Spanish verses in Python
MIT License
3 stars 0 forks source link

Synalephas based on "y" or same letter frontier are sometimes not contemplated #4

Open masouto94 opened 1 year ago

masouto94 commented 1 year ago

I created an object class that groups verses of poems and uses the functionality of syllable count and I found out that sometimes synalephas are not calculated right... For example in these sonnets:

"El poeta le pide a su amor que le escriba" (Federico Garcia Lorca):
[
'Pero yo te sufrí. Rasgué mis venas,',
 'tigre y paloma, sobre tu cintura', 
'en duelo de mordiscos y azucenas.'
], 'syllables': [11, 11, 12]
"Feliciano me adora y le aborrezco" (Sor Juana Ines de la Cruz)
[
'Si con mi ofensa al uno reconvengo;', 
'Me reconviene el otro a mí ofendido;', 
'Y a padecer de todos modos vengo;'
], 'syllables': [11, 12, 12]

In both cases y azucenas and reconviene el otro a mí have multiple intepretations:

I was thinking if it was possible to return an array of possibilities of synalephas in order to know if some combination may fit in the metric rules of a poem class. It is a bit confusing how synalephas are calculated. I would appreciate some guidance on it

neburnodrog commented 1 year ago

Hola Masouto94,

so, the possibility to return an array of possibilities would be a bit tricky since it would be a breaking change. The program needs to be able to provide a solution to the count of syllables for me to work. if there are multiple solutions to the synalephas problem then how would the program decide which to use to provide the final count?

I would anyways need to know exactly what you want to do with it and how so that I can think of an interface that would work for you as well as for me.

What you could also do is to access the synalephas variable of the syllabified verse and separate them if needed. I'll take one of the verses you've given as an example.

pyverse = Pyverse('Me reconviene el otro a mí ofendido')
print(pyverse.count) // 12
print(pyverse.synalephas) // ['reconviene el', 'otro a']

So there you can see the synalephas that are beeing accounted for. So reconviene_el and otro_a are taken into consideration. That mean that if you want to break them you would have to add two to the count:

broken_synalephas_count = pyverse.count + len(pyverse.synalephas)

Not sure if this is what you would need.

masouto94 commented 1 year ago

Thanks for the answer. In the cases when I would like to break them I'll do as you say. But actually, my real problem are not the synalephas that the program reconizes but those that are not taken into account. In the first example "y azucenas" is not considered and that adds one to the final count. It says it has 12 syllables when it should count 11. Where should I look in order to add a new rule to be considered for synalephas?

neburnodrog commented 1 year ago

Hola,

I can add a fix for that case this weekend if you want. Last weekend i released v1.1 with some other bug fixes and a refactoring.

But feel free to clone the repo and try to fix it. You can add a test case for that verse if you want.

Synalephas are added after the whole sentence has been syllabified. Is the "last step" so to speak so it shouldnt't be that difficult.

Best regards Karlsson

On Wed, Jun 7, 2023, 17:18 masouto94 @.***> wrote:

Thanks for the answer. In the cases when I would like to break them I'll do as you say. But actually, my real problem are not the synalephas that the program reconizes but those that are not taken into account. In the first example "y azucenas" is not considered and that adds one to the final count. It says it has 12 syllables when it should count 11. Where should I look in order to add a new rule to be considered for synalephas?

— Reply to this email directly, view it on GitHub https://github.com/neburnodrog/Pyverse/issues/4#issuecomment-1581042901, or unsubscribe https://github.com/notifications/unsubscribe-auth/API62QRH52QJEGAYUFA7EKLXKCLS7ANCNFSM6AAAAAAYQVBHMM . You are receiving this because you commented.Message ID: @.***>

masouto94 commented 1 year ago

Thanks! I'll check on these days