🧩 Silabificador
A Portuguese syllabifier built from Portuguese phonotactics. Rule-based, dependency-free, no model to load.
📦 Features
- Syllabification for Portuguese, derived from the licit onset inventory and the diphthong/hiatus rules rather than from a table of special cases.
- Stress, primary and secondary, read out of the orthography that encodes it.
- Syllable structure, not just strings: onset, glide, nucleus, coda.
- The output always reconstructs the input — hyphens, spaces and apostrophes are kept, 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']
Need the constituents, or 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 one takes the primary:
[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 surface and
docs/advanced.md for the rules and the known limits.
📊 Accuracy
Measured against the Portuguese Unified Pronunciation Lexicon, which carries syllabifications from two independent authorities — Infopédia (Porto Editora) and the Portal da Língua Portuguesa.
The gold is the set of words the two sources independently agree on (35,181), after discarding any entry whose syllables do not reconstruct its headword. Every word is scored — no sampling, no caps.
| 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 |
Every one of the 116,959 scoreable words reconstructs exactly.
Where the two authorities disagree (135 words — on morpheme boundaries, and on etymological hiatus) neither answer is scored against, 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 is the 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 had better agree with it, and it does.
Reproduce it, and see every remaining failure bucketed by cause:
pip install -e ".[benchmark]"
python -m benchmark.report
📄 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.0.tar.gz.
File metadata
- Download URL: silabificador-2.1.0.tar.gz
- Upload date:
- Size: 28.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
757fe6c61145c8cd8c8cb513b2428584423d7b4d0341c745fb47356c1be493dc
|
|
| MD5 |
5e50c54601ee108ee42aee1fe48cdfd2
|
|
| BLAKE2b-256 |
ebafb78c241ee1bcda13103c013d129711c48acb23e17f0b16192cc7ac97078b
|
File details
Details for the file silabificador-2.1.0-py3-none-any.whl.
File metadata
- Download URL: silabificador-2.1.0-py3-none-any.whl
- Upload date:
- Size: 23.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac3ed085cdb4c385092c2532b4c57092e5ca9e51f156906aa7ac4370ddd70d5a
|
|
| MD5 |
f98a182142a078abbbd40344eaa16d88
|
|
| BLAKE2b-256 |
cea8e1766571d5a12937fa86e264ac72bb0e2ab52779d777716baaa742bc2e5a
|