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 git+https://github.com/TigreGotico/silabificador
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']
See docs/api.md for the full API surface and
docs/advanced.md for the rules and the known limits.
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 (35,181 words), after discarding any entry whose syllables do not reconstruct its headword. Every word is scored. There is no sampling and no cap.
| set | exact match | |
|---|---|---|
| agreement (gold) | 99.87% | 35,137 / 35,181 |
| Infopédia | 99.34% | 99,619 / 100,279 |
| Portal | 99.81% | 51,763 / 51,861 |
All 116,959 scoreable words reconstruct exactly.
Where the two authorities disagree (135 words, 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.
| stress accuracy | 99.83% | 43,819 / 43,893 |
| gold self-check | 99.75% | 4,712 / 4,724 |
The self-check gives a reason to trust the 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, and it does.
To reproduce the accuracy numbers and see every remaining failure bucketed by cause, run:
pip install -e ".[benchmark]"
python -m benchmark.report
Related projects
Silabificador is part of the TigreGotico Portuguese phonetics toolchain, alongside:
License
MIT License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file silabificador-2.1.1a1.tar.gz.
File metadata
- Download URL: silabificador-2.1.1a1.tar.gz
- Upload date:
- Size: 29.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb64981c176facbf546e9039699945b51edaeb62b2b52cd9ba40f4a78c726af8
|
|
| MD5 |
1b5e2772228d3cf2c233e179abffd45d
|
|
| BLAKE2b-256 |
5e9e2b0b231a4fcd7695b4b6e6763e4b9bf9e08a98649fa58a7c91b4ff8a9161
|
File details
Details for the file silabificador-2.1.1a1-py3-none-any.whl.
File metadata
- Download URL: silabificador-2.1.1a1-py3-none-any.whl
- Upload date:
- Size: 23.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14ab0672810cd3c02d9475cf95325a0205bda1ebca8388d1e6965106f9b1569f
|
|
| MD5 |
6a61acec9f8deb029e3290e05ea25cfe
|
|
| BLAKE2b-256 |
b153d9500dda7a45e0d9c84db9b713a4b49eaa45bedcc8fb46e516b6767c2915
|