Skip to content

Stabilize Italian time readings and electronic punctuation tests - #533

Open
janbernloehr wants to merge 2 commits into
NVIDIA:mainfrom
janbernloehr:fix/italian-electronic-punctuation
Open

janbernloehr wants to merge 2 commits into
NVIDIA:mainfrom
janbernloehr:fix/italian-electronic-punctuation

Conversation

@janbernloehr

@janbernloehr janbernloehr commented Nov 13, 2026 •

Copy link
Copy Markdown

What does this PR do ?

Stabilize Italian time readings across Pynini versions and correct the punctuation mode used by electronic normalization tests.

For 12:30, equal-cost verbalizer paths let Pynini 2.1.7 exports produce dodici e mezza where the deterministic deployment fixture expects dodici e trenta minuti. Give numeric minutes priority over mezza and un quarto for :30 and :15, with or without seconds. Nondeterministic verbalization retains both readings at equal cost. Strengthen Python checks to require the existing first expected reading, assert the cost ordering, and add shared Python/Sparrowhawk cases for 12:15 and 15:30:30.

The electronic fixture is shared with Sparrowhawk and expects raw grammar output, including a space before a final period (punto com .). The Python test enabled punct_post_process, which removes that space (punto com.), causing four failures. Run the shared fixture without punctuation cleanup and add eight separate cleanup cases. Existing electronic expectations and all existing time alternatives are preserved.

Before your PR is "Ready for review"

Pre checks:

  • Have you signed your commits? Use git commit -s to sign.
  • Do all unittests finish successfully before sending PR?
    1. pytest or (if your machine does not have GPU) pytest --cpu from the root folder (given you marked your test cases accordingly @pytest.mark.run_only_on('CPU')).
    2. Sparrowhawk tests bash tools/text_processing_deployment/export_grammars.sh --MODE=test ...
  • If you are adding a new feature: Have you added test cases for both pytest and Sparrowhawk here. (Not applicable: bugfix; regression coverage is included in both.)
  • Have you added __init__.py for every folder and subfolder, including data folder which has .TSV files? (Not applicable: no new folders.)
  • Have you followed codeQL results and removed unused variables and imports (report is at the bottom of the PR in github review box) ?
  • Have you added the correct license header Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. to all newly added Python files? (Not applicable: no new Python files.)
  • If you copied nemo_text_processing/text_normalization/en/graph_utils.py your header's second line should be Copyright 2015 and onwards Google, Inc.. See an example here. (Not applicable.)
  • Remove import guards (try import: ... except: ...) if not already done. (Not applicable: no import guards added or modified.)
  • If you added a new language or a new feature please update the NeMo documentation (lives in different repo). (Not applicable.)
  • Have you added your language support to tools/text_processing_deployment/pynini_export.py. (Not applicable: Italian TN is already supported.)

Validation:

  • All 70 Italian CPU tests pass with Python 3.13.12 / Pynini 2.1.6.post1 and Python 3.14.3 / Pynini 2.1.7, using fresh grammar caches. This includes numeric time preferences and preservation of nondeterministic alternatives.
  • Four time cases in each fresh exported FAR have a unique lowest-cost numeric reading. The saved pre-fix exports tie all four.
  • All seven Italian Sparrowhawk shell test functions pass with fresh exports from each Pynini version. A supplemental batch check passes all 54 deployment records on each version, strictly against the first expected output, including records skipped by the shell loop's handling of unterminated final lines.
  • Full CPU suite on Python 3.13.12 / Pynini 2.1.6.post1: 13,555 passed across all 22 groups, with no failures, errors, or skips. Optional audio-based expansion was disabled; Kinyarwanda ran uncached.

PR Type:

  • New Feature
  • Bugfix
  • Documentation
  • Test

If you haven't finished some of the above items you can still open "Draft" PR.

Signed-off-by: Jan Bernloehr <jbernloehr@nvidia.com>
@janbernloehr janbernloehr mentioned this pull request Nov 19, 2026
11 of 14 tasks
Prefer numeric minutes for deterministic quarter-hour and half-hour readings, including times with seconds. Preserve equally weighted colloquial alternatives in nondeterministic grammars and pin the shared fixture preferences with path-cost and deployment regressions.

Signed-off-by: Jan Bernloehr <jbernloehr@nvidia.com>
@janbernloehr janbernloehr changed the title Fix Italian electronic tests for raw and post-processed punctuation Stabilize Italian time readings and electronic punctuation tests Nov 22, 2026
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.

1 participant