Skip to content

Tamil TN Cardinal Semiotic Class - #449

Open
surendran-246 wants to merge 23 commits into
NVIDIA:staging/tamil_tn_v1from
surendran-246:feat-ta-cardinal
Open

Tamil TN Cardinal Semiotic Class#449
surendran-246 wants to merge 23 commits into
NVIDIA:staging/tamil_tn_v1from
surendran-246:feat-ta-cardinal

Conversation

@surendran-246

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) 2023, 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.

surendran-246and others added 10 commits July 7, 2026 13:51
Signed-off-by: surendran-246 <surendrans@nvidia.com>
Signed-off-by: surendran-246 <surendrans@nvidia.com>
Signed-off-by: surendran-246 <surendrans@nvidia.com>
Signed-off-by: surendran-246 <surendrans@nvidia.com>
Signed-off-by: surendran-246 <surendrans@nvidia.com>
Signed-off-by: surendran-246 <surendrans@nvidia.com>
Signed-off-by: surendran-246 <surendrans@nvidia.com>
Signed-off-by: surendran-246 <surendrans@nvidia.com>
for more information, see https://pre-commit.ci
Signed-off-by: surendran-246 <surendrans@nvidia.com>
Signed-off-by: surendran-246 <surendrans@nvidia.com>
Signed-off-by: surendran-246 <surendrans@nvidia.com>
@surendran-246surendran-246 changed the title Tamil language cardinal semiotic classTamil TN Cardinal Semiotic ClassJul 7, 2026
@surendran-246
surendran-246 marked this pull request as ready for review July 7, 2026 10:50
surendran-246and others added 6 commits July 8, 2026 11:04
Signed-off-by: surendran-246 <surendrans@nvidia.com>
Signed-off-by: surendran-246 <surendrans@nvidia.com>
Signed-off-by: surendran-246 <surendrans@nvidia.com>
Signed-off-by: surendran-246 <surendrans@nvidia.com>
Signed-off-by: surendran-246 <surendrans@nvidia.com>
@github-actions

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.

Signed-off-by: surendran-246 <surendrans@nvidia.com>
Signed-off-by: surendran-246 <surendrans@nvidia.com>
@github-actions

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.

surendran-246and others added 2 commits August 10, 2026 12:23
Signed-off-by: surendran-246 <surendrans@nvidia.com>

@folivoramanhfolivoramanh left a comment

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.

make sure both pytest and sparrrowhawk test pass

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 there any solution that not listing 10 - 99? (eg 20 - 29 share same rule ಮೂ + digit?)

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.

same question: is there any solution that not listing 10 - 99? (eg 20 - 29 share same rule ಮೂ + digit?)


class CardinalFst(GraphFst):
"""
Finite state transducer for classifying cardinals, e.g.

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 check other language's format and refractor the docstring

digit = sf("digit")
zero = sf("zero")
teens_ties = pynini.union(sf("teens_and_ties"), sf("teens_and_ties_en"))
teens_and_ties = pynutil.add_weight(teens_ties, -0.1)

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.

try not to add custom weight

def __init__(self, deterministic: bool = True, lm: bool = False):
super().__init__(name="cardinal", kind="classify", deterministic=deterministic)

def sf(name):

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.

dont need

super().__init__(name="word", kind="classify", deterministic=deterministic)

# Define Tamil characters and symbols using pynini.union
TAMIL_CHAR = pynini.union(

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.

list in tsv pls

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.

if dont use post processing, is there any redundant blank space? if yes, try to figure out the root cause from your implementation (punct, word, etc...), do not abuse post processing

output = SPACE_DUP.sub(' ', output[1:])

if self.lang in ["en", "hi", "vi"] and hasattr(self, 'post_processor') and self.post_processor is not None:
if (

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.

if self.lang in ["en", "hi", "ta", "vi"] and hasattr(self, 'post_processor') and self.post_processor is not None:

to_lower = args.input_case == "lower_cased"
training_data = load_files([file_path], to_lower=to_lower)

# print("Loading training data: " + file_path)

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.

delete

@pytest.mark.unit
def test_norm(self, test_input, expected):
pred = self.normalizer.normalize(test_input, verbose=False)
assert pred.strip() == expected.strip()

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.

remove .strip()

Sign up for freeto 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.

2 participants

@surendran-246@folivoramanh