Package: silabeador
SilabeadorA Python library for syllabic division and stress detection for Spanishsilabeadoris a Python library of methods and functions for syllabic division and prosodic stress detecting for Spanish.
This library is part of the research projectSound and Meaning in Spanish Golden Age Literature. Automatic verse scansion required a syllable separator tolerant to non-Spanish consonant clusters and unusual and non-Spanish diacritics. Other libraries available take for granted that the words are well-constructed according to the Spanish grammar. This is not always the case in particular text types, as inüas regularly used or as a metric diacritic (e.g.,Si-güen-zavscrü-el).It achieves 99.81 % accuracy when tested against the corpusEDFUwithout exceptions and 98.51 % when applying exceptions such as the implicit hiatus in verbs in-uar(a-cen-tu-ar) or-uir(re-hu-ir), or words some nouns (a-rri-e-ro).Installationpip3installsilabeadorUseThe library provides functions and methods that can be called idependently:>>>importsilabeadorThe syllabic division function accepts a string as a single argument and returns a list of syllables.>>>silabeador.sillabify('Uvulopalatofaringoplastia')['U','vu','lo','pa','la','to','fa','rin','go','plas','tia']The function to recover the stressed syllable's index takes a string as s single argument and returns the stressed syllable's index.>>>silabeador.tonica('Uvulopalatofaringoplastia')-2An alternative version accepts a list of syllables and returns the stressed syllable's index.>>>silabeador.stressed_s(['U','vu','lo','pa','la','to','fa','rin','go','plas','tia'])-2An object with those values can also be created:>>>x=silabeador.Syllabification('Uvulopalatofaringoplastia')>>>x.syllables['U','vu','lo','pa','la','to','fa','rin','go','plas','tia']>>>x.stress-2DescriptionSyllabificationThe syllabic division follows the principles described by Quilis (2013, 47-49; 2019, 182-192).Firstly, syllabic nuclei are detected looking for the vowels. Unstressed close vowels join the adjacent vowels in coda or onset to form a diphthong or a triphthong, whilst stressed ones are considered standalone syllabic nuclei. Contiguous consonants are grouped to be parsed apart.Secondly, consonant clusters are divided considering whether their components are separable and joined to the neighbour nuclei in coda or onset accordingly.The methodSyllabification()accepts the following arguments:word,exceptions,ipa, andh. Only the first one is compulsory, as the method requires a word to parse. The default value ofexceptionsisTrueand tells whethet the exceptions file should be used. The others' value isFalse. If a IPA transcription instead is used,ipashould beTrueto achieve optimal results. The flaghmarks the behaviour when parsing a clusterV-C-<h>-V. The default division would beVC <h>V(en-hies-to). IfhisTrue, the division would beV C<h>V(e-nhies-to).Prosodic stressProsodic stress detection follows the Spanish rules described by the Real Academia ("tilde"). Proparoxytone words are always orthographically signalled with an acute accent on the nucleic vowel of the antepenultimate syllable. Paroxytones are not marked unless the word ends withn,sor vowel, in which case they have an acute accent on the nucleic vowel of the penultimate syllable. Oxytone words are only marked if they end inn,sor vowel with an acute accent on the nucleic vowel of the last syllable. If there is a word without orthographic accent and a recognisable Latin inflection that not appears in Spanish, the prosodic stress is determined according to the latin rules if the quantity of the penultimate syllable can be guessed from the orthography. Otherwise, it tries to guess with the orthographic information available.Exceptions to the diphthong rulesSome words such as verbs most verbs in-uirand all verbs in-uar, as well as adjectives in-uosoand nouns such asguiónorclientedo not do a diphthong (Quilis, 2019, 185-186). So they are pronounced/in-fa-tu-ar/,/a-tri-bu-ir/,/un-tu-o-so/o/gui-on/. Optionally, the processing of these nouns can be dissabled to avoid the hiatus.>>>silabas('cruel').silabas['cru',' el']>>>silabas('cruel',False).silabas['cruel']Alternatively, the fileexcepciones.lstcan be edited to include or remove words. A morpheme can be used instead of full words (i.e.,acuoswould fitacuoso,acuosa,acuososandacuosas). For convenience, lines can be commented.Known problemsAdverbs in-mentehave primary and secondary stress. Therefore, they must be divided, and each of their parts parsed  independently.ContributionsFeel free to contribute using theGitHub Issue Trackerfor feedback, suggestions, or bug reports.Changelog1.1.11-6** rüin produces ru-ín instead ru-in1.1.11-5** frue, flue1.1.11-4** desafiante, desviado, etc.LicenceThis project is under GNU LGPL 2.1. SeeLICENCEfor details.ReferencesQuilis, Antonio,Tratado de fonología y fonétia españolas. 1993. Madrid, Gredos, 2019.---,Métrica española. 1984. Barcelona, Ariel, 1996."tilde".Diccionario panhispánico de dudas, 2005.https://www.rae.es/dpd/tilde