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
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/)
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.
There was a problem hiding this comment.
ok, thanks! one more comment though: graph_arabs / graph_kharabs / graph_padmas / graph_shankhs name tiers that produce no such word. The file already uses crore-relative naming for its prefix helpers (hundred_crore_prefix, lakh_crore_count_prefix, ten_lakh_crore_prefix), so this is internally inconsistent too. Renaming to that existing convention — graph_hundred_crores (10^9), graph_ten_thousand_crores (10^11), graph_lakh_crores (10^13), graph_crore_crores (10^15) — would make the structure self-describing.
There was a problem hiding this comment.
@mgrafu Done. Renamed higher tiers to the crore-relative convention already used in the file:
graph_arabs → graph_hundred_crores
graph_ten_arabs → graph_thousand_crores
graph_kharabs → graph_ten_thousand_crores
graph_ten_kharabs → graph_lakh_crores
graph_ten_nils → graph_ten_lakh_crores
graph_padmas → graph_crore_crores
graph_ten_padmas → graph_ten_crore_crores
graph_shankhs → graph_hundred_crore_crores
|
Thanks for the follow-up review. Changes Made:
Testing:
Re: Spanish reusable component: replied in the thread with details. |
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
|
Thanks for the review. Changes Made:
Testing:
|
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> Signed-off-by: Haridas Nishitha <nharidas@nvidia.com>
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> Signed-off-by: Haridas Nishitha <nharidas@nvidia.com>
for more information, see https://pre-commit.ci Signed-off-by: Haridas Nishitha <nharidas@nvidia.com>
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> Signed-off-by: Haridas Nishitha <nharidas@nvidia.com>
Signed-off-by: Haridas Nishitha <nharidas@nvidia.com>
Signed-off-by: Haridas Nishitha <nharidas@nvidia.com>
for more information, see https://pre-commit.ci Signed-off-by: Haridas Nishitha <nharidas@nvidia.com>
Signed-off-by: Haridas Nishitha <nharidas@nvidia.com>
77befb5 to
0f44929
Compare
Signed-off-by: Haridas Nishitha <nharidas@nvidia.com>
|
@mgrafu Thanks for the review. Changes Made:
Testing:
|
| @@ -0,0 +1,98 @@ | |||
| ~ | |||
There was a problem hiding this comment.
please follow the style of English word test cases
There was a problem hiding this comment.
also, are specific English test cases necessary?
There was a problem hiding this comment.
@mgrafu Done. updated the TE word tests to follow the English style (empty/whitespace, leading/trailing space, sentences with punct, hyphenated words, digit+punct spacing, etc.), with Telugu examples.
EN cases that need measure/money grammars, or English-only letter+digit splits, aren’t covered yet since those aren’t in TE.
There was a problem hiding this comment.
let's test just Telugu for now instead of English. Please remove lines like $ and 5% or %~$ and ఐదు % or % or X!~X!
| 4 నాలుగులు~నాలుగు నాలుగులు | ||
| ౬ మంది ఆటగాళ్లు బయటకు~ఆరు మంది ఆటగాళ్లు బయటకు | ||
| 4 ఓవర్లలో 17 పరుగులు~నాలుగు ఓవర్లలో పదిహేడు పరుగులు | ||
| ౫ చాక్లెట్లు ౯ టాఫీలు~ఐదు చాక్లెట్లు తొమ్మిది టాఫీలు |
There was a problem hiding this comment.
let's review and add these test cases
51010000000~ఐదు వేల నూట ఒక కోటి
34018285364~మూడు వేల నాలుగు వందల ఒక కోటి ఎనభై రెండు లక్షల ఎనభై ఐదు వేల మూడు వందల అరవై నాలుగు
711010000000~డెబ్బై ఒక వేల నూట ఒక కోటి
465017762066~నలభై ఆరు వేల ఐదు వందల ఒక కోటి డెబ్బై ఏడు లక్షల అరవై రెండు వేల అరవై ఆరు
3164010000000~మూడు లక్షల పదహారు వేల నాలుగు వందల ఒక కోటి
97931010000000~తొంభై ఏడు లక్షల తొంభై మూడు వేల నూట ఒక కోటి
90140000000000000~తొమ్మిది వందల ఒక కోటి నలభై లక్షల కోట్లు
340100000000000000~మూడు వేల నాలుగు వందల ఒక కోటి కోట్లు
340182853640000000~మూడు వేల నాలుగు వందల ఒక కోటి ఎనభై రెండు లక్షల ఎనభై ఐదు వేల మూడు వందల అరవై నాలుగు కోట్లు
4650177620660000000~నలభై ఆరు వేల ఐదు వందల ఒక కోటి డెబ్బై ఏడు లక్షల అరవై రెండు వేల అరవై ఆరు కోట్లు
51020000000~ఐదు వేల నూట రెండు కోట్లు
34028285364~మూడు వేల నాలుగు వందల రెండు కోట్ల ఎనభై రెండు లక్షల ఎనభై ఐదు వేల మూడు వందల అరవై నాలుగు
90240000000000000~తొమ్మిది వందల రెండు కోట్ల నలభై లక్షల కోట్లు
90100000000000000~తొమ్మిది వందల ఒక కోటి కోట్లు
10010000000~వెయ్యి ఒక కోటి
20010000000~రెండు వేల ఒక కోటి
50010000000~ఐదు వేల ఒక కోటి
10001010000000~పది లక్షల నూట ఒక కోటి
10000000101~వెయ్యి కోట్ల నూట ఒకటి
10000000201~వెయ్యి కోట్ల రెండు వందల ఒకటి
220000000000000~రెండు కోట్ల ఇరవై లక్షల కోట్లు
230000000000000~రెండు కోట్ల ముప్పై లక్షల కోట్లు
410000000000000~నాలుగు కోట్ల పది లక్షల కోట్లు
941302654706146~తొమ్మిది కోట్ల నలభై ఒక లక్షల ముప్పై వేల రెండు వందల అరవై ఐదు కోట్ల నలభై ఏడు లక్షల ఆరు వేల నూట నలభై ఆరు
851750346234890~ఎనిమిది కోట్ల యాభై ఒక లక్షల డెబ్బై ఐదు వేల ముప్పై నాలుగు కోట్ల అరవై రెండు లక్షల ముప్పై నాలుగు వేల ఎనిమిది వందల తొంభై
0౫~0౫
౦5~౦5
00౭~00౭
0౦5~0౦5
05~సున్నా ఐదు
౦౫~సున్నా ఐదు
007~సున్నా సున్నా ఏడు
౦౦౭~సున్నా సున్నా ఏడు
There was a problem hiding this comment.
@mgrafu Done. Added all the test cases you listed. A few didn’t match at first (…01 కోటి, ఒక vs ఒకటి before లక్షల, and mixed-script zeros). Fixed those; everything passes now.
Signed-off-by: Haridas Nishitha <nharidas@nvidia.com>
for more information, see https://pre-commit.ci
|
@mgrafu 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.