Skip to content

Created cardinal Semiotic class for Kannada TN - #448

Open
richa-2002 wants to merge 46 commits into
NVIDIA:staging/kannada_tn_v1from
richa-2002:feat-kn-cardinal
Open

Created cardinal Semiotic class for Kannada TN#448
richa-2002 wants to merge 46 commits into
NVIDIA:staging/kannada_tn_v1from
richa-2002:feat-kn-cardinal

Conversation

@richa-2002

@richa-2002 richa-2002 commented Jul 7, 2026

Copy link
Copy Markdown

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:

  • 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.
  • Have you added __init__.py for every folder and subfolder, including data folder which has .TSV files?
  • 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) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. to all newly added 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.
  • Remove import guards (try import: ... except: ...) if not already done.
  • If you added a new language or a new feature please update the NeMo documentation (lives in different repo).
  • Have you added your language support to tools/text_processing_deployment/pynini_export.py.

PR Type:

  • New Feature
  • Bugfix
  • Documentation
  • Test

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

richa-2002 and others added 15 commits June 16, 2026 09:29
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
@richa-2002
richa-2002 marked this pull request as ready for review July 7, 2026 10:49
richa-2002 and others added 7 commits July 13, 2026 13:18
Signed-off-by: richa-2002 <richa@nvidia.com>
…iles

Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
pre-commit-ci Bot and others added 5 commits July 23, 2026 12:24
1
Signed-off-by: richa-2002 <richa@nvidia.com>
3
Signed-off-by: richa-2002 <richa@nvidia.com>
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

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.

Comment thread nemo_text_processing/text_normalization/kn/verbalizers/verbalize_final.py Outdated
Comment thread tests/nemo_text_processing/kn/test_sparrowhawk_normalization.sh Outdated
Comment thread Jenkinsfile Outdated
@richa-2002

Copy link
Copy Markdown
Author

Thank you for the review, @mgrafu. I have addressed all the changes you suggested.

Additionally, I removed the unnecessary weights from cardinal.py file from tagger module.

Testing
Cardinal pytest test cases passed.
Sparrowhawk testTNCardinal passed.

@richa-2002
richa-2002 requested a review from mgrafu September 2, 2026 10:06
Signed-off-by: richa-2002 <richa@nvidia.com>
class CardinalFst(GraphFst):
"""
Finite state transducer for classifying cardinals, e.g.
23 -> cardinal { negative: "true" integer: "ಇಪ್ಪತ್ತಮೂರು" }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's document what is the max magnitude for large numbers that the grammar covers

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment thread Jenkinsfile
Comment thread tests/nemo_text_processing/kn/test_cardinal.py
class CardinalFst(GraphFst):
"""
Finite state transducer for classifying cardinals, e.g.
23 -> cardinal { negative: "true" integer: "ಇಪ್ಪತ್ತಮೂರು" }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

23 or -23?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-23, done. Replaced it with the maximum magnitude covered by the grammar.

richa-2002 and others added 7 commits September 9, 2026 13:42
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
Signed-off-by: richa-2002 <richa@nvidia.com>
@richa-2002

Copy link
Copy Markdown
Author

Thank you for the review, @mgrafu. I have addressed all the changes you suggested.

Testing

  • Pytest: All test cases passed — Cardinal, Word, and Punctuation.
  • Sparrowhawk: All test cases passed — testTNCardinal, testTNWord, and testTNPunctuation.

@richa-2002
richa-2002 requested a review from mgrafu September 9, 2026 11:43
@@ -0,0 +1,20 @@
ನಿದ್ರೆ~ನಿದ್ರೆ
ಯಾಹೂ!~ಯಾಹೂ!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please follow the style of English word test cases

@richa-2002 richa-2002 Sep 10, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the word test cases to align with the English test cases style, covering whitespace, leading/trailing spaces, punctuation, hyphenated words, and digit–punctuation spacing.

Measure, money, decimal grammar scenarios and English-specific letter–digit splits are not included yet, as Kn does not currently support those cases.

@@ -0,0 +1,74 @@
.~.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please follow the style of English punctuation test cases

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the Kn punctuation test cases based on the English test case format.Added test_cases_punctuation_match_input.txt to cover punct_post_process=True, where punctuation spacing is adjusted to match the original input similar to EN.

Measure, money, decimal grammar scenarios and English-specific letter–digit splits are not included yet, as Kn does not currently support those cases.

ಡಾ. ರಾಮು~ಡಾ. ರಾಮು
ಎ.ಪಿ.~ಎ.ಪಿ.
ರೂ. ನೂರು~ರೂ. ನೂರು
2!~ಎರಡು !

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is a spaced introduced after TN?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extra spaces occur when punct_post_process=False. When punct_post_process=True, those spaces are removed.

import pynini
from pynini import Far
from pynini.export import export
from pynini.lib import byte, pynutil, utf8

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please clean up any unused imports in all scripts (byte is not used here)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

"""
Finite state transducer for verbalizing cardinals, e.g.
cardinal { integer: "ಐದು" } -> ಐದು
cardinal { negative: "true" integer: "ಇಪ್ಪತ್ತ್ಮೂರು" } -> ಮೈನಸ್ ಇಪ್ಪತ್ತ್ಮೂರು

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the same spelling as in TSV?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Signed-off-by: richa-2002 <richa@nvidia.com>
@richa-2002

Copy link
Copy Markdown
Author

Thank you for the review, @mgrafu. I have addressed all the changes you suggested.

Testing

Pytest: All test cases passed — Cardinal, Word, and Punctuation.
Sparrowhawk: All test cases passed — testTNCardinal, testTNWord, and testTNPunctuation.

@richa-2002
richa-2002 requested a review from mgrafu September 10, 2026 09:52
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.

3 participants