Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Silabificador

Silabificador splits a Portuguese word into syllables. It uses hand-crafted rules based on Portuguese phonotactics. It has no runtime dependencies and loads no model.

Features

  • Syllabification for Portuguese, derived from the licit onset inventory and the diphthong/hiatus rules, not from a table of special cases.
  • Stress, primary and secondary, read from the orthography that encodes it.
  • Syllable structure, not just strings: onset, glide, nucleus, coda.
  • The output always reconstructs the input. Hyphens, spaces, and apostrophes stay in place and are never dropped.
  • No dependencies.

Installation

pip install silabificador

Silabificador needs Python 3.11 or later. The --pre flag of pip installs the latest alpha.

Usage

from silabificador import syllabify

syllabify("computador")     # ['com', 'pu', 'ta', 'dor']
syllabify("guarda-chuva")   # ['guar', 'da-', 'chu', 'va']

Use analyze for the constituents, or stressed_index for the stress:

from silabificador import analyze, stressed_index

for s in analyze("transportar"):
    print(s.onset, s.nucleus, s.coda, s.stressed)
# tr a ns False
# p  o r  False
# t  a r  True      -> trans.por.TAR

stressed_index("sílaba")   # 0   SÍ.la.ba

A compound keeps a stress on every element. The last element takes the primary stress:

[str(s) for s in analyze("guarda-chuva") if s.secondary]   # ['guar']
[str(s) for s in analyze("guarda-chuva") if s.stressed]    # ['chu']

Documentation

Accuracy

Silabificador is measured against the Portuguese Unified Pronunciation Lexicon. This lexicon carries syllabifications from two independent authorities: Infopédia (Porto Editora) and the Portal da Língua Portuguesa.

The gold set is the set of words the two sources independently agree on, after discarding any entry whose syllables do not reconstruct its headword. The engine is also scored against each source on its own. Every word is scored. There is no sampling and no cap.

Where the two authorities disagree, on morpheme boundaries and on etymological hiatus, the tool scores against neither answer, because there is no fact of the matter to be right about.

Stress is measured against a gold the engine cannot see: the lexicon's IPA transcriptions, which mark stress with ˈ. Nothing in the engine reads IPA. A self-check gives a reason to trust that gold. On a simple word, a written accent is the stress, by definition of the spelling rules, so the IPA-derived answer must agree with it.

docs/accuracy.md holds the numbers. The benchmark writes that page, and prints every remaining failure bucketed by cause:

pip install -e ".[benchmark]"
python -m benchmark.report --markdown docs/accuracy.md

The benchmark extra downloads the lexicon from Hugging Face on the first run.

Silabificador is part of the TigreGotico Portuguese phonetics toolchain, alongside:

  • orthography2ipa: its portuguese extra installs silabificador and registers it as the Portuguese plugin in the orthography2ipa.syllabify entry-point group.
  • tugaphone: depends on silabificador and syllabifies through that orthography2ipa plugin.
  • bifonia
  • g2p_barranquenho

Development

pip install -e ".[test]"
python -m pytest tests

The suite runs offline. tests/test_accuracy_regression.py scores a fixed sample of the gold in tests/gold_sample.json, and the full scoreboard comes from python -m benchmark.report. Do not edit docs/accuracy.md by hand.

License

MIT License

Metadata

Release files for silabificador 2.1.1a5

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

Source distribution (sdist)

Source distribution for silabificador 2.1.1a5
File Size Uploaded Provenance Actions
silabificador-2.1.1a5.tar.gz 29.8 kB Without provenance Details for silabificador-2.1.1a5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for silabificador 2.1.1a5
File Interpreter ABI Platform Actions
silabificador-2.1.1a5-py3-none-any.whl Python 3 none any Details for silabificador-2.1.1a5-py3-none-any.whl

Total release size: 53.6 kB

Release files / silabificador-2.1.1a5.tar.gz

Download URL silabificador-2.1.1a5.tar.gz
Size 29.8 kB
Tags Source
SHA-256 checksum
How to use checksums
02c4bdc11a6dac69b38c1a59dd91464eab5d3cf38ded470a9308a36b12feff8d
BLAKE2b-256 checksum
How to use checksums
6c4922e5c706b0fc5b21dae8460925682c627d11f7e3be9d1bad8513c86d05a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / silabificador-2.1.1a5-py3-none-any.whl

Download URL silabificador-2.1.1a5-py3-none-any.whl
Size 23.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac59a269ad317570449a79198c3ea13f8c365c8f50377cb12a31055f632e02db
BLAKE2b-256 checksum
How to use checksums
43fd8c632ca74ce3dfc89bfab4e7badacf9473a243adc2afe5a053bc052cfc63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for silabificador 2.1.1a5

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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