Skip to content

feat(normalizer): add Brazilian Portuguese normalization - #553

Merged
remsky merged 7 commits into
remsky:masterfrom
Udbhav-regadamilli:codex/portuguese-normalization
Nov 13, 2026
Merged

remsky merged 7 commits into
remsky:masterfrom
Udbhav-regadamilli:codex/portuguese-normalization

Conversation

@Udbhav-regadamilli

Copy link
Copy Markdown
Contributor

Summary

  • Add Brazilian Portuguese number, currency, time, and common unit normalization.
  • Register language code p and add focused regression cases.
  • Leave invalid times and long identifier-like digit runs unchanged.

Closes #392

Validation

  • py_compile passed for the implementation and test module.
  • Direct normalization smoke checks passed for integers, currencies, times, units, and long digit runs.
  • The pytest suite could not be run here: pytest and ruff were unavailable, and installing test dependencies failed because the local Python/SDK build environment could not compile pydantic-core.

@remsky

remsky commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Hey @Udbhav-regadamilli, thanks for this. A few things before it can go in:

  • CI is failing on the two unit cases. unit_normalization is off by default (same as English), so those cases need NormalizationOptions(unit_normalization=True). Worth keeping one default case showing km left alone too
  • Needs a rebase, or I can resolve on this end; just the CHANGELOG section.
  • num2words only comes in through misaki right now, can you add it to the deps in pyproject.toml directly
  • We'd want to add a few Portuguese floods to test_normalizer_redos.py (digit runs, 1.000 runs, R$1, runs etc) through get_normalizer("p"), since these regexes run on request text

@Udbhav-regadamilli
Udbhav-regadamilli force-pushed the codex/portuguese-normalization branch from 52484be to 47c601e Compare November 4, 2026 18:21
@Udbhav-regadamilli

Copy link
Copy Markdown
Contributor Author

Hi @remsky, I have made the relevant changes; please check them once.

@Udbhav-regadamilli

Copy link
Copy Markdown
Contributor Author

Hi @remsky, just following up on this PR. I’ve pushed the requested changes, and the latest checks are green. When you have a chance, could you please take another look? Happy to make any further adjustments. Thanks!

@remsky

remsky commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Hey @Udbhav-regadamilli, thanks for the patience! That covers everything from my last pass.

Think there's a few cases and rules that'll need some follow-ups/feedback from native speakers e.g some numbers before feminine nouns like hora need the feminine form (duas horas, instead of dois horas). But this still improves on the current default, glad to merge it in. Thanks again.

@remsky
remsky merged commit 92456ff into remsky:master Nov 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Portuguese language normalization

2 participants