Scan your whole stack
From OX Research Newsroom
Are you using tugaphone?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v1.11.7a2
tugaphone was last scanned on 24 Nov 2026 at version 1.11.7a2. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 1.11.7a2 LATEST | 24 Nov 2026 | No rules fired |
| 1.11.7a1 | 24 Nov 2026 | No rules fired |
| 1.11.6a2 | 23 Nov 2026 | No rules fired |
| 1.11.6a1 | 22 Nov 2026 | Not shown |
| 1.11.5a3 | 22 Nov 2026 | Not shown |
Findings for v1.11.7a2. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 1.11.7a2; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
tugaphone turns Portuguese text into IPA, and it does it per Lusophone dialect. Give it a sentence and a dialect code, get back a phoneme string with stress marks.
O gato dorme.
pt-PT → u ˈɡatu ˈdɔɾmɨ
pt-BR → u ˈɡatu ˈdoɾmi
pt-AO → ʊ ˈɡatʊ ˈdɔʁmɨ
pt-MZ → u ˈɡatu ˈdɔrme
pt-TL → o ˈɡato ˈdɔrme
Every IPA sample in these docs is the output of the orthography2ipa lect specs
that tugaphone resolves at run time, so a spec change in orthography2ipa can
change a sample. The samples in docs/tokenizer.md come from
the deprecated tugaphone.dialects inventory instead.
Under the hood it drives the
orthography2ipa candidate
lattice: a dialect is an orthography2ipa lect spec, and the spec's grapheme
table, allophone rules and cross-word sandhi produce that dialect's phonology
directly. tugaphone adds the stages orthography2ipa leaves to the caller: old-spelling
conversion, text normalization, gender- and scale-aware number expansion,
meaning-based homograph marking and the residual lexicon of pt-PT and pt-BR, wired through
orthography2ipa's own extension points. See
docs/architecture.md.
uv pip install --prerelease=allow tugaphone
The package defines one extra for users, langdetect. The test extra is for
development.
uv pip install --prerelease=allow "tugaphone[langdetect]"
The langdetect extra installs markovonnx, which scores the statistical
code-switch detector. Without it, code-switch detection uses an orthographic
heuristic. See docs/codeswitch.md.
Its runtime dependencies (orthography2ipa, o2i-lexicons, silabificador,
tugalex, bifonia, text2spoken, desacordo_ortografico) install automatically. The pt-PT
and pt-BR lexicons ride in through o2i-lexicons.
from tugaphone import TugaPhonemizer
ph = TugaPhonemizer()
print(ph.phonemize_sentence("O gato dorme.", "pt-PT"))
# u ˈɡatu ˈdɔɾmɨ
Construct TugaPhonemizer(), then call phonemize_sentence(text, lang) as
often as you like. The first call for a lect builds that lect's engine, so it is
slower than the calls after it. The result is a
space-separated phoneme string, one token per word, with ˈ marking primary
stress. lang selects the orthography2ipa lect spec, so it changes the
phonology, not just the spelling.
Digits need no preparation. phonemize_sentence spells them out with gender
agreement before it transcribes the sentence:
print(ph.phonemize_sentence("comprei 2 casas", "pt-PT"))
# kõˈpɾej ˈduɐʃ ˈkazɐʃ
Most Portuguese G2P you can reach for treats Portuguese as one or two varieties. tugaphone's reason to exist is dialect granularity: one API that spans the whole Lusophone space and, within European Portuguese, a set of sub-regional accents.
| Tool | Portuguese coverage | Notes |
|---|---|---|
| espeak-ng | pt (European) + pt-br (Brazilian) |
Small, fast, rule-based, about 100 languages, widely used as a TTS front-end. Two Portuguese varieties only, no African/Asian Lusophone, no sub-regional accents. |
| phonemizer (bootphon) | via espeak-ng | A backend wrapper, for Portuguese it delegates to espeak-ng, so the same two varieties. Needs the espeak binary. |
| Single-variety Portuguese toolkits (e.g. Brazilian-focused phonetic transcribers) | one national variety | Strong within their variety, not built to cover the full Lusophone range from one interface. |
| tugaphone | every Portuguese-family orthography2ipa lect: five national standards + European, Brazilian, African, Asian and other varieties | Pure Python, IPA output with stress, meaning-based homograph resolution, one API across the whole Lusophone space. |
What tugaphone buys you over the coarse options:
pt-PT, pt-BR, pt-AO, pt-MZ, pt-TL) plus European and
Brazilian sub-regional varieties and the African, Asian and other lects.pt-PT, short
scale for pt-BR).Honest trade-offs: tugaphone is Portuguese-only and younger than espeak-ng, which covers far more languages and years of field use. Its accuracy against the per-lect gold is measured openly, see docs/benchmarking.md.
The five national standards, plus European, Brazilian, African, Asian and other
sub-regional lects. list_dialects() returns the full set:
| Code | Region |
|---|---|
pt-PT |
European Portuguese, heavy vowel reduction, post-alveolar fricatives, uvular /ʁ/ |
pt-BR |
Brazilian Portuguese, fuller vowels, /t d/ palatalisation, l-vocalisation |
pt-AO |
Angolan Portuguese, moderate reduction, alveolar trill, Bantu substrate |
pt-MZ |
Mozambican Portuguese, similar to European with regional variation |
pt-TL |
Timorese Portuguese, conservative pronunciation, Tetum substrate |
for code in ["pt-PT", "pt-BR", "pt-AO", "pt-MZ", "pt-TL"]:
print(code, "→", ph.phonemize_sentence("Choveu muito ontem.", code))
# pt-PT → ʃuˈvew ˈmũj̃tu ˈõtɐ̃j̃
# pt-BR → ʃoˈvew ˈmũj̃tu ˈõtẽj̃
# pt-AO → ʃoˈvew ˈmũj̃tʊ ˈõtẽj̃
# pt-MZ → ʃoˈvew ˈmũj̃tu ˈõtẽ
# pt-TL → ʃoˈvew ˈmũj̃to ˈõtẽj̃
The European sub-regional lects (pt-PT-x-porto, -braga, -tras-os-montes,
-madeira, -acores, …), the Brazilian ones (pt-BR-x-sp, -rj, -caipira,
-bahia, …) and the rest are all reachable the same way. See
docs/dialects.md for the full list and the legacy aliases.
An unknown code falls back to its parent lect, or else to pt-PT, with a
warning. is_supported(code) tells
you first whether a code names a lect:
from tugaphone import is_supported
is_supported("pt-BR-x-sao-paulo") # True
is_supported("en-US") # False
Heterophonic homographs are resolved by meaning via bifonia: sede thirst
vs headquarters, forma mould vs shape, gosto noun vs verb. bifonia inserts
open/closed-vowel diacritics in the pipeline's mark stage, after number
expansion and before the lattice transcribes the sentence, so the same spelling
maps to different pronunciations depending on sentence context.
# gosto as a verb
print(ph.phonemize_sentence("Eu gosto de música."))
# ˈew ˈɡɔʃtu dɨ ˈmuzikɐ
# gosto as a noun
print(ph.phonemize_sentence("Tenho bom gosto."))
# ˈteɲu ˈbõ ˈɡoʃtu
Sub-regional accents are lects like any other, select one by its BCP-47
private-use code. Its phonology (betacism, rising diphthongs, palatalization,
/u/ fronting, coda-sibilant sandhi, …) is encoded in the orthography2ipa lect
spec, so no extra argument is needed:
# Porto: rising diphthongs, betacism (/v/ → [b])
print(ph.phonemize_sentence("O vinho é muito bom.", "pt-PT-x-porto"))
# u ˈbiɲu ˈjɛ ˈmũj̃tu ˈbõ
# Trás-os-Montes: <ch> → [tʃ], betacism
print(ph.phonemize_sentence("A chave.", "pt-PT-x-tras-os-montes"))
# ɐ ˈtʃabɨ
from tugaphone import list_dialects
print("pt-PT-x-porto" in list_dialects())
# True
list_dialects() returns every registered lect code.
Legacy tugaphone accent codes and the old orthography2ipa keys resolve as
aliases (pt-PT-x-azores → pt-PT-x-acores, pt-BR-x-sao-paulo →
pt-BR-x-sp, pt-PT-x-trasosmontes → pt-PT-x-tras-os-montes, …). See
docs/dialects.md.
Selecting a lect describes an accent, force_accent forces one into a
downstream voice. For a phoneme-input TTS (phoonnx-style) that is the target
IPA, for a grapheme-input TTS (a fixed pt-PT voice) it is Portuguese text
respelled so the base voice reads it as the target sounds, feed a pt-PT
voice binho to force the Northern betacism of vinho.
from tugaphone import force_accent
# phoneme-input TTS: the target accent's IPA
force_accent("o vinho verde", "pt-PT-x-porto", mode="ipa")
# 'u ˈbiɲu ˈbjɛɾdɨ'
# grapheme-input pt-PT TTS: respelled text it will pronounce with the accent
force_accent("o vinho verde", "pt-PT-x-porto", mode="respell", base_lect="pt-PT")
# 'o binho berde'
The respeller is verification-gated (an edit is kept only if it moves the base
voice's own reading toward the target), so it never makes a word worse and
leaves unspellable contrasts alone. Ad-hoc per-voice tweaks live in a
JSON-serialisable AccentOverlay, and examples/12_synthetic_corpus.py
generates a parallel (sentence, lect, ipa, respelled_text) training corpus.
See docs/accent_forcing.md.
phonemize_sentence reads numbers, dates, clock times, money, measures,
Roman numerals and abbreviations with
text2spoken. normalize_numbers
exposes that step on its own, for a TTS front-end that needs the text:
from tugaphone.number_utils import normalize_numbers
normalize_numbers("Nasceu a 25/12/2023.")
# 'Nasceu a vinte e cinco de dezembro de dois mil e vinte e três.'
normalize_numbers("A reunião é às 19h30.")
# 'A reunião é às dezanove horas e trinta minutos.'
normalize_numbers("A reunião é às 19h30.", "pt-BR")
# 'A reunião é às dezenove horas e trinta minutos.'
normalize_numbers("vou comprar 1 casa") # 'vou comprar uma casa'
The European lects and the African and Asian lects read the pt-PT variety
("dezanove"). The Brazilian lects and pt-UY read the pt-BR variety
("dezenove"). A form with digits that text2spoken cannot read, such as "3D",
gives an UnreadFormWarning that names the form and the text, because the
phoneme lattice drops its digits. See docs/numbers.md.
text2spoken reads first, and its reading stands. A form that it leaves as written, such as "3-2", "Chegou 16:54." or "2L", goes to a fallback rewrite of tugaphone, so "2L" reads as "dois litros". Each fallback goes when text2spoken reads its form.
tugaphone also expands the forms that text2spoken does not read. Abbreviations such as "vs.", "pág." and "n.º" expand, so "vs." reads as "versus". A title such as "Sr." or "Dr." expands everywhere, so "o Sr. presidente" reads as "o Senhor presidente". A letter-digit code reads as its letters and a number, so "T2" reads as "tê dois". Acronyms are spelled with Portuguese letter names, so "IA" reads as "i á", while lowercase words such as "ia" are left alone. The full rule list with examples is in docs/text_normalization.md.
Stress and the dialect's phonology come from the orthography2ipa lect spec.
Syllabification comes from the bundled splitter of orthography2ipa, which reads
the diphthongs and hiatus of the lect spec. Only the deprecated
tugaphone.tokenizer token tree syllabifies with
silabificador.
The package installs a tugaphone command:
tugaphone phonemize "o gato dorme" --lect pt-BR
tugaphone force-accent "o vinho verde" --lect pt-PT-x-porto --mode respell --base pt-PT
tugaphone list
phonemize defaults to --lect pt-PT. force-accent takes --mode ipa or
--mode respell, and --overlay reads a JSON AccentOverlay. See
docs/accent_forcing.md.
tugaphone.pipeline(lect) returns the orthography2ipa Pipeline that
tugaphone runs for a lect: the packaged lexicon, the number expansion and the
homograph marks. A program that already drives orthography2ipa.G2P gets
tugaphone's output from it:
from orthography2ipa import G2P
import tugaphone
engine = G2P("pt-BR", pipeline=tugaphone.pipeline("pt-BR"))
print(engine.transcribe("o gato dorme")) # u ˈɡatu ˈdoɾmi
The pipeline covers contact="none", the default. lect must be a code of
list_dialects(); resolve a loose tag with resolve_lect first.
tugaphone phonemizes by driving the shared o2i candidate lattice. A dialect
is an o2i lect spec: phonemize_sentence(text, lang) resolves lang to a
lect code and runs orthography2ipa.G2P(lect).transcribe(text). The spec's
grapheme table, allophone_rules and cross-word sandhi_rules produce the
dialect's phonology, including genuinely cross-word processes like
coda-sibilant voicing sandhi, with no string-transform pass after
transcription.
tugaphone contributes the stages o2i leaves to the caller, wired through o2i's own extension points, and relies on o2i for syllabification:
| Concern | Owner |
|---|---|
| Base phonology, dialect phenomena, sandhi, stress | orthography2ipa lect spec |
| Old spellings to the AO1990 spelling of the lect | desacordo_ortografico, called by tugaphone (lattice_core.normalize_spelling, via Pipeline.expand) |
| Number, date and time reading | text2spoken, called by tugaphone (number_utils, via Pipeline.expand) |
| Sense-based homograph marking | tugaphone (bifonia, via Pipeline.mark) |
pt-PT and pt-BR residual lexicons |
o2i-lexicons, passed by tugaphone through Pipeline |
| Syllabification | orthography2ipa (the bundled splitter) |
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.