Skip to main content

A Python library of methods and functions for syllabic division and prosodic stress detecting for Spanish

Project description

License: LGPL Version: 1.1.3 Python versions: 3.5, 3.6, 3.7, 3.8, 3.9

Silabeador

A Python library for syllabic division and stress detection for Spanish

silabeador is a Python library of methods and functions for syllabic division and prosodic stress detecting for Spanish. This library is part of the research project Sound 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-za vs crü-el).

It achieves 99,40 % precission when tested against the corpus EDFU, although the value should be significantly higher as that corpus does not apply t excepttions to the syllabication, 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').

Installation

pip3 install silabeador

Use

The library provides functions and methods that can be called idependently:

>>> import silabeador

The syllabic division function accepts a string as a single argument and returns a list of syllables.

>>> silabeador.silabea('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')
-2

An alternative version accepts a list of syllables and returns the stressed syllable's index.

>>> silabeador.tonica_s(['U', 'vu', 'lo', 'pa', 'la', 'to', 'fa', 'rin', 'go', 'plas', 'tia'])
-2

An object with those values can also be created:

>>> objeto_silabas = silabeador.silabas('Uvulopalatofaringoplastia')
>>> objeto_silabas.palabra
'Uvulopalatofaringoplastia'
>>> objeto_silabas.silabas
['U', 'vu', 'lo', 'pa', 'la', 'to', 'fa', 'rin', 'go', 'plas', 'tia']
>>> objeto_silabas.tonica
-2

Description

Sillabification

The 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.

Prosodic stress

Prosodic 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 with n, s or 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 in n, s or vowel with an acute accent on the nucleic vowel of the last syllable.

Exceptions to the diphthong rules

Some words such as verbs most verbs in -uir and all verbs in -uar, as well as adjectives in -uoso and nouns such as guión or cliente do 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 file excepciones.lst can be edited to include or remove words. A morpheme can be used instead of full words (i.e., acuos would fit acuoso, acuosa, acuosos and acuosas). For convenience, lines can be commented.

Known problems

Adverbs in -mente have primary and secondary stress. Therefore, they must be divided, and each of their parts parsed independently.

Contributions

Feel free to contribute using the GitHub Issue Tracker for feedback, suggestions, or bug reports.

Licence

This project is under GNU LGPL 2.1. See LICENCE for details.

References

Quilis, 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

silabeador-1.1.3.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

silabeador-1.1.3-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file silabeador-1.1.3.tar.gz.

File metadata

  • Download URL: silabeador-1.1.3.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.7.0 requests/2.26.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

File hashes

Hashes for silabeador-1.1.3.tar.gz
Algorithm Hash digest
SHA256 14b4ab97882b6838a07e81c46da40e3e2f2902b93df57d16f2f195034aacc726
MD5 60241cc985113d0ca9580f4d06579aca
BLAKE2b-256 dd7d2e3b1e3f69f8b97c875f66d159c6d57fc78b630ea5c10906592acb73dc40

See more details on using hashes here.

File details

Details for the file silabeador-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: silabeador-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.7.0 requests/2.26.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

File hashes

Hashes for silabeador-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e1f5f5453d0c069ce8aad7356ca3fd002604ea94401da96d4b5c9ccfeff9c3e9
MD5 5a02b228cca2fb2ecd05c1b74e519e82
BLAKE2b-256 832eb8afc070398054acda0e78ff7d61bf333fb96fc6863fcb263fb117ea3411

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page