Skip to main content

License: LGPL Version: 1.2.4-1 Python versions: 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12

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.81 % accuracy when tested against the corpus EDFU without 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).

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.syllabify('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.stressed_s(['U', 'vu', 'lo', 'pa', 'la', 'to', 'fa', 'rin', 'go', 'plas', 'tia'])
-2

An 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
-2

Description

Syllabification

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.

The method Syllabification() accepts the following arguments: word, exceptions, ipa, and h. Only the first one is compulsory, as the method requires a word to parse. The default value of exceptions is True and tells whethet the exceptions file should be used. The others' value is False. If a IPA transcription instead is used, ipa should be True to achieve optimal results. The flag h marks the behaviour when parsing a cluster V-C-<h>-V. The default division would be VC <h>V (en-hies-to). If h is True, the division would be V C<h>V (e-nhies-to).

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

Changelog

  • 1.2.4

    • ui, qué, que and multiword
  • 1.2.2-1

    • Solved bug qué
  • 1.2.1

    • Solved crash on 'y'
  • 1.2.0

    • ChatGPT optimisation and documentation
  • 1.1.12

    • last-syllable stress for words in [a-u]y without tilde
  • 1.1.11-6

    • rüin produces ru-ín instead ru-in
  • 1.1.11-5

    • frue, flue
  • 1.1.11-4

    • desafiante, desviado, etc.

How to cite silabeador

Authors of scientific papers including results generated using silabeador are encouraged to cite the following paper.

@article{SanzLazaroF_RHD2023, 
    author    = {Sanz-Lázaro, Fernando},
    title     = {Del fonema al verso: una caja de herramientas digitales de escansión teatral},
    volume    = {8},
    date  = {2023},
    journal   = {Revista de Humanidades Digitales},
    pages = {74-89},
    doi = {https://doi.org/10.5944/rhd.vol.8.2023.37830}
}

Copyright (C) 2022 Fernando Sanz-Lázaro <fsanzl@gmail.com>

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library. If not, see <https://www.gnu.org/licenses/>.

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

Metadata

Release files for silabeador 1.2.4.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for silabeador 1.2.4.post1
File Size Uploaded Provenance Actions
silabeador-1.2.4.post1.tar.gz 21.8 kB With provenance Details for silabeador-1.2.4.post1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for silabeador 1.2.4.post1
File Interpreter ABI Platform Actions
silabeador-1.2.4.post1-py3-none-any.whl Python 3 none any Details for silabeador-1.2.4.post1-py3-none-any.whl

Total release size: 41.1 kB

Release files / silabeador-1.2.4.post1.tar.gz

Download URL silabeador-1.2.4.post1.tar.gz
Size 21.8 kB
Tags Source
SHA-256 checksum
How to use checksums
93f74a991797152e2181a8f7fa8b8108e96b254d2709be330fff89a5e6a07d28
BLAKE2b-256 checksum
How to use checksums
28555c2e6c77391fb9f232b7f181e6b7a16e68b8303d42d2822ab0491919a755
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.

Transparency log

Release files / silabeador-1.2.4.post1-py3-none-any.whl

Download URL silabeador-1.2.4.post1-py3-none-any.whl
Size 19.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1b797fa0217d7108ed75b2214eac7873486084ed874d8b9baf35d0b3a9ed79c
BLAKE2b-256 checksum
How to use checksums
0372e678e6123de22898cff1e47ee242a27b8673f59fe77b2481934c4d2355bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.

Transparency log

Security for silabeador 1.2.4.post1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for silabeador-1.2.4.post1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page