Skip to main content
Pre-release

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

TugaLex 🗣️

TugaLex is a comprehensive lexicon handler and linguistic utility for Portuguese dialects. It provides deep data on phoneme transcription (IPA), syllable segmentation, and historical/modern orthographic rules.

Designed for NLP pipelines and linguistics research, it allows you to handle the complexities of Portuguese across different regions and historical agreements with a unified API.


🌍 Supported Dialects

TugaLex maps standard ISO codes to internal regional datasets:

ISO Code Internal Code Region
pt-PT lbx Portugal (Lisbon)
pt-BR rjx Brazil (Rio de Janeiro)
spx Brazil (São Paulo)
pt-AO lda Angola (Luanda)
pt-MZ mpx Mozambique (Maputo)
pt-TL dli Timor-Leste (Díli)

The regional dictionary ships as a slim gzip extract (word, POS, phones, syllables, region) of the unified Portuguese pronunciation lexicon, regenerated with python scripts/build_regional_dict.py. Words whose pronunciation does not vary by part of speech carry a single POS-invariant entry that answers every POS query.


✨ Key Features

1. Phonemes & Syllables

Retrieve IPA transcriptions and syllable breaks based on the word's Part-of-Speech (POS) and specific region.

from tugalex import TugaLexicon

lex = TugaLexicon()

# Get both syllables and phonemes
info = lex.get("acordo", pos="NOUN", region="lbx")
# Output: {'syllables': ['a', 'cor', 'do'], 'phonemes': 'ɐˈkoɾdu'}

# POS matters!
verb_phonemes = lex.get_phonemes("acordo", pos="VERB")
# Output: 'ɐˈkɔɾdu'
verb_phonemes = lex.get_phonemes("acordo", pos="NOUN")
# Output: 'ɐˈkoɾdu'

2. Orthographic Agreement (AO1990)

Effortlessly convert text between pre-agreement and post-agreement (AO1990) standards for both Portugal and Brazil.

  • Normalize: Old spelling → Modern spelling.
  • Reverse: Modern spelling → Old regional spelling (PT or BR).
normalized = lex.normalize_ao1900(sentence)

3. Linguistic Insights

TugaLex identifies specific linguistic phenomena programmatically:

  • Homographs: Words that change pronunciation based on POS (e.g., sede (thirst) vs sede (headquarters)).
  • Archaic Words: Mapping 19th-century etymological spellings to modern ones.
  • Silent Letters: Identifying words with silent 'p' or 'c' common before the 1990 agreement.
  • Voiced 'u': Detecting words where 'u' is pronounced in 'gue/gui/que/qui' clusters (formerly marked with a trema ü).

📂 Datasets

TugaLex ships the following datasets which contain over 100,000 entries sourced from the Portal da Língua Portuguesa.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tugalex-2.0.0a1.tar.gz (61.6 kB view details)

Uploaded Source

Built Distribution

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

tugalex-2.0.0a1-py3-none-any.whl (58.8 kB view details)

Uploaded Python 3

File details

Details for the file tugalex-2.0.0a1.tar.gz.

File metadata

  • Download URL: tugalex-2.0.0a1.tar.gz
  • Upload date:
  • Size: 61.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tugalex-2.0.0a1.tar.gz
Algorithm Hash digest
SHA256 7c6ae0b026cb448f730bd9b5b1b2875ee260f746ba853970203e5cd87e9bf114
MD5 9dbdfa76144737d7da258699c8f48c57
BLAKE2b-256 014440360e24a7c3a1efee71fe39e6aad0cb6f2895e04212058a38ec7375987d

See more details on using hashes here.

File details

Details for the file tugalex-2.0.0a1-py3-none-any.whl.

File metadata

  • Download URL: tugalex-2.0.0a1-py3-none-any.whl
  • Upload date:
  • Size: 58.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tugalex-2.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 d1059e5f1b56bc93e984edcfe843a0c03fae0217f8db9f5980dde24f901d8e49
MD5 bf7ca88c22c9def3060b62209320af8d
BLAKE2b-256 90a5e19c7b3d2df67baa338f4bad409efcb31b4c1ce12a3b9ce640f56e6e4935

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