De ITN: decouple cardinal grammar from TN - #487
Open
adelina23dunina wants to merge 10 commits into
Open
adelina23dunina wants to merge 10 commits into
adelina23dunina wants to merge 10 commits into
Conversation
Signed-off-by: Adelina Dunina <adunina@nvidia.com>
mgrafu
reviewed
Sep 11, 2026
mgrafu
reviewed
Sep 11, 2026
mgrafu
reviewed
Sep 11, 2026
mgrafu
reviewed
Sep 11, 2026
mgrafu
reviewed
Sep 11, 2026
mgrafu
reviewed
Sep 11, 2026
mgrafu
reviewed
Sep 11, 2026
Signed-off-by: Adelina Dunina <adunina@nvidia.com>
Signed-off-by: Adelina Dunina <adunina@nvidia.com>
Signed-off-by: Adelina Dunina <adunina@nvidia.com>
Signed-off-by: Adelina Dunina <adunina@nvidia.com>
Signed-off-by: Adelina Dunina <adunina@nvidia.com>
mgrafu
reviewed
Sep 14, 2026
| from nemo_text_processing.inverse_text_normalization.de.utils import get_abs_path, load_labels | ||
|
|
||
|
|
||
| AND = "und" |
Collaborator
There was a problem hiding this comment.
tsv file instead of hardcoding
mgrafu
reviewed
Sep 14, 2026
| tens = pynini.string_file(get_abs_path("data/cardinal/tens.tsv")) | ||
| ties = tens + pynutil.insert("0") | ||
| # German flips ones and tens in two-digit numbers. The WFST below handles these flips. | ||
| delete_und = pynutil.delete(AND) |
Collaborator
There was a problem hiding this comment.
let's use the closure instead of adding .ques
mgrafu
reviewed
Sep 14, 2026
| @@ -0,0 +1,42 @@ | |||
| # Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |||
Signed-off-by: Adelina Dunina <adunina@nvidia.com>
Signed-off-by: Adelina Dunina <adunina@nvidia.com>
Signed-off-by: Adelina Dunina <adunina@nvidia.com>
adelina23dunina
force-pushed
the
de_itn_cardinal_decoupled_v2
branch
from
September 15, 2026 17:46
61c1ad8 to
6fb8682
Compare
Signed-off-by: Adelina Dunina <adunina@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do ?
Rebuilds the German ITN cardinal grammar as a standalone WFST with its own TSV data, so it no longer depends on inverting the German TN cardinal tagger and verbalizer.
Details:
CardinalFstin both the tagger and the verbalizer now take no arguments. The grammar isbuilt from new tables in
de/data/cardinal/(zero,digits,irregular_teens,teens,tens) instead of fromtn_cardinal_tagger/tn_cardinal_verbalizer.de/graph_utils.pyandde/utils.pyto the ITN submodule.eintausend->1.000rather than1000.date/decimal/fraction/measure/money/ordinal/telephone are unaffected:
graph_no_exception,graph_hundred_component_at_least_one_none_zero_digit,optional_minus_graph.DE_TN_CACHEin theJenkinsfileso CI rebuilds the grammars instead of reusingstale compiled FARs.
Before your PR is "Ready for review"
Pre checks:
git commit -sto sign.pytestor (if your machine does not have GPU)pytest --cpufrom the root folder (given you marked your test cases accordingly@pytest.mark.run_only_on('CPU')).bash tools/text_processing_deployment/export_grammars.sh --MODE=test ...pytestand Sparrowhawk here. — updatedtests/nemo_text_processing/de/data_inverse_text_normalization/test_cases_cardinal.txt, which feeds bothtest_cardinal.pyandtest_sparrowhawk_inverse_text_normalization.sh__init__.pyfor every folder and subfolder, includingdatafolder which has .TSV files? — addedde/data/__init__.pyandde/data/cardinal/__init__.pyCopyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.to all newly added Python files?Copyright 2015 and onwards Google, Inc.. See an example here.try import: ... except: ...) if not already done. — none present ininverse_text_normalization/de/PR Type: