Skip to main content
Pre-release

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

TugaLex

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

It gives NLP pipelines and linguistics research a single API for the differences between Portuguese regions and historical spelling agreements.


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)
n/a 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. Regenerate it 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)

Convert text between pre-agreement and post-agreement (AO1990) spelling for Portugal and Brazil.

  • Normalize: Old spelling to modern spelling.
  • Reverse: Modern spelling to 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. Together they contain over 100,000 entries sourced from the Portal da Língua Portuguesa.


Install

pip install -e .

TugaLex has no third-party runtime dependencies. All datasets ship inside the package under tugalex/data/.


Related Projects

TugaLex is one piece of the TigreGotico Portuguese NLP stack:

  • tugaphone: phonemizes arbitrary Portuguese text across dialects, using TugaLex plus a rule-based fallback.
  • tugamorph: rule-based morphological analyzer for Portuguese.
  • tugatagger: Part-of-Speech tagging wrapper for Portuguese.
  • desacordo_ortografico: detects and converts between Portuguese orthographies, including the AO1990 reform.

License

TugaLex is released under the Apache License 2.0.

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.1a2.tar.gz (2.6 MB 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.1a2-py3-none-any.whl (2.6 MB view details)

Uploaded Python 3

File details

Details for the file tugalex-2.0.1a2.tar.gz.

File metadata

  • Download URL: tugalex-2.0.1a2.tar.gz
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tugalex-2.0.1a2.tar.gz
Algorithm Hash digest
SHA256 8bc2afd1a1cccbfdffb9d5fa0af2916757a81bf5bca183d64e4dc1959ce68639
MD5 abb0ae5d4e44d1e75937f283798a9e49
BLAKE2b-256 973b5607beced391bc3d691bf91bd4f15f89b2a3afb60c6abbb5e06db1ed97f4

See more details on using hashes here.

File details

Details for the file tugalex-2.0.1a2-py3-none-any.whl.

File metadata

  • Download URL: tugalex-2.0.1a2-py3-none-any.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tugalex-2.0.1a2-py3-none-any.whl
Algorithm Hash digest
SHA256 80478fc986c91762b51a221a09ac02c83a13d3382e60e9ed930478351f835996
MD5 243e2463824c81ca95262b3571429ac6
BLAKE2b-256 8d30f2426b2f3f459c50dfd33c38267af08469c0eaed05a11b271ebc38accd23

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