Telugu TN: Cardinal Semiotic Class - #447
Conversation
4a71ee5 to
f918e66
Compare
|
This PR is stale because it has been open for 14 days with no activity. Remove stale label or comment or update or this will be closed in 7 days. |
folivoramanh
left a comment
There was a problem hiding this comment.
make sure both pytest and sparrowhawk test pass, and fix the problem of blank space
| } | ||
| } | ||
| } | ||
| stage('L0: Create TE TN/ITN Grammars') { |
There was a problem hiding this comment.
add only stage('L0: Codeswitched HI/EN ITN grammars') {
steps {
sh 'CUDA_VISIBLE_DEVICES="" python nemo_text_processing/inverse_text_normalization/inverse_normalize.py --lang=hi_en --text="एक" --cache_dir ${HI_EN_TN_CACHE}'
}
}
(replace info with your language) - only add stage and steps (look how other language added)
There was a problem hiding this comment.
keep only stage('L0: TE TN grammars') {
steps {
sh 'CUDA_VISIBLE_DEVICES="" python nemo_text_processing/text_normalization/normalize.py --lang=te --text="౧" --cache_dir ${TE_TN_CACHE}'
}
9d8b75f to
b224888
Compare
|
Thanks for the review. I’ve addressed the comments on this PR.
pytest for Telugu cardinals is passing. Sparrowhawk tests are still pending; I’ll update this PR once they are run. |
folivoramanh
left a comment
There was a problem hiding this comment.
- add init file in data/ (currently only in data/numbers/)
| } | ||
| } | ||
| } | ||
| stage('L0: Create TE TN/ITN Grammars') { |
There was a problem hiding this comment.
keep only stage('L0: TE TN grammars') {
steps {
sh 'CUDA_VISIBLE_DEVICES="" python nemo_text_processing/text_normalization/normalize.py --lang=te --text="౧" --cache_dir ${TE_TN_CACHE}'
}
There was a problem hiding this comment.
check this example and see that if you can build a reusable component for thousand/million/billion/trillion
https://github.com/NVIDIA/NeMo-text-processing/blob/main/nemo_text_processing/text_normalization/es/taggers/cardinal.py
There was a problem hiding this comment.
Thanks for the pointer. I reviewed, es/taggers/cardinal.py.
Spanish works with one reusable block because it uses the Western scale: each step adds 6 zeros (thousand → million → billion → trillion) and reuses the same 3-digit pattern with a new magnitude word.
Telugu uses the Indian numbering system, which is structured differently:
- 1,000 → thousand
- 1,00,000 → lakh (not “hundred thousand”)
- 1,00,00,000 → crore
- higher tiers (arab, kharab, nil, padma, shankh) with different digit groupings
On top of that, the spoken form is not one fixed word per magnitude. It depends on position in the number and what follows, for example:
- singular vs plural / “before” forms (e.g. వేల vs వేలు, కోటి vs కోట్లు)
- special “one” form when combining (ఒక in 21, 31, … vs ఒకటి for standalone 1)
- prefix variants (e.g. నూట vs వంద for hundreds)
- special lakh form (లక్షా)
So we cannot drop in one ES-style thousand/million/billion component, both the scale and the word forms change at each tier.
This current code already reuses shared logic where the grammar allows it:
- build_group, create_graph_suffix, create_larger_number_graph
- magnitude ladders (thousand → lakh → crore → …)
- shared strings in
magnitudes.tsv
The longer code reflects real Telugu morphology, not unnecessary duplication. Collapsing it into one Spanish-style block would risk wrong readings (e.g. 21 → ఇరవై ఒక, not ఇరవై ఒకటి).
There was a problem hiding this comment.
if it uses the Indian numbering system, are we building the graph in the same way that the Hindi graph does?
There was a problem hiding this comment.
@mgrafu Yes, same Indian numbering system and the same overall graph structure as Hindi.
Both use the tiered scale (hundred → thousand → lakh → crore → arab/kharab/nil/…) with the same create_graph_suffix / create_larger_number_graph pattern and the same 2+3 digit grouping.
Telugu extends that base for language-specific morphology: singular/plural/before magnitude forms, special “one” handling (ఒక vs ఒకటి), and hundred prefixes (నూట vs వంద), driven by TSVs and build_group ladders. Hindi uses a simpler one-suffix-per-tier model.
|
Thanks for the follow-up review. Changes Made:
Testing:
Re: Spanish reusable component: replied in the thread with details. |
|
|
||
| def __init__(self, deterministic: bool = True): | ||
| super().__init__(name="punctuation", kind="classify", deterministic=deterministic) | ||
| s = "!#%&\'()*+,-./:;<=>?@^_`{|}~\"" |
There was a problem hiding this comment.
does the language need additional punctuation?
There was a problem hiding this comment.
Telugu uses standard punctuation, same as Hindi. The tagger already covers all Unicode punctuation plus ASCII symbols, so no additional punctuation is needed.
There was a problem hiding this comment.
I don't see the poorna viram in the above list. does that mean Telugu doesn't use it?
There was a problem hiding this comment.
@mgrafu Poorna viram (।, U+0964) isn’t in the ASCII string s, but it is included via punct_unicode. Same pattern as Hindi TN. So traditional । / ॥ and Western . common in modern Telugu are both covered.
3fb9a92 to
415b3cf
Compare
Rebased onto staging/telugu_tn_v1 with TE-only changes for PR NVIDIA#447. Signed-off-by: Haridas Nishitha <nharidas@nvidia.com> Co-authored-by: Cursor <cursoragent@cursor.com>
15c6609 to
1e9a8cb
Compare
Use TSV-based digit definitions in graph_utils, restore load_labels in utils, and update Jenkinsfile with correct cache paths and TE CI stages. Signed-off-by: Haridas Nishitha <nharidas@nvidia.com> Co-authored-by: Cursor <cursoragent@cursor.com>
for more information, see https://pre-commit.ci
tokenize_and_classify passed a punctuation argument that WordFst no longer accepts after the staging rebase. Signed-off-by: Haridas Nishitha <nharidas@nvidia.com> Co-authored-by: Cursor <cursoragent@cursor.com>
|
Thanks for the review. Changes Made:
Testing:
|
What does this PR do ?
Add a one line overview of what this PR aims to accomplish.
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.__init__.pyfor every folder and subfolder, includingdatafolder which has .TSV files?Copyright (c) 2026, 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.PR Type:
If you haven't finished some of the above items you can still open "Draft" PR.