Skip to main content
Pre-release

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

🧩 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

silabificador-2.1.0a1.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

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

silabificador-2.1.0a1-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file silabificador-2.1.0a1.tar.gz.

File metadata

  • Download URL: silabificador-2.1.0a1.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

Hashes for silabificador-2.1.0a1.tar.gz
Algorithm Hash digest
SHA256 abccd05606bd4c352742e9eeae1c4ffde1a69b10c5b4af088fe6d7035e26ffc2
MD5 d2a5aac0042f08ab336cb233ceec9f40
BLAKE2b-256 1f36d31bd9a361e4b0b746ee488cf7e7be6ad4555c5096e9ee168c3eed802075

See more details on using hashes here.

File details

Details for the file silabificador-2.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for silabificador-2.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 a1c3fc29d4c179b5e48c99d2fdbe709f8fa23f53b0f72c20e26edff4a94e9907
MD5 e166e38ef325e069f2f4c37c0cf47d39
BLAKE2b-256 63a055b3fc43824a4ee975703e54be8c88d2534a4bb7f2d53689e5722cacbbba

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 Sentry Error logging StatusPage Status page