Tamil TN Cardinal Semiotic Class - #449
Conversation
b06d8e8 to
6b431c2
Compare
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>
231dd35 to
eaf2223
Compare
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>
|
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>
0e62120 to
2907744
Compare
Signed-off-by: surendran-246 <surendrans@nvidia.com>
for more information, see https://pre-commit.ci
Signed-off-by: surendran-246 <surendrans@nvidia.com>
|
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. |
for more information, see https://pre-commit.ci
Signed-off-by: surendran-246 <surendrans@nvidia.com>
Completed the pytest and sparrowhawk tests, and both passed successfully. |
| @@ -0,0 +1,36 @@ | |||
| 100 நூறு | |||
There was a problem hiding this comment.
looking at one hundred, these could be compressed into a rule. would this also apply for the other hundreds? if so, please refactor
(1 > நூ) followed by (delete 00 or insert ற்) followed by (insert று)
There was a problem hiding this comment.
Yes, applies to all hundreds. Replaced hundred_ta.tsv with hundred_stem.tsv (digit → stem only).
Exact = stem + delete "00" + insert "று" (100, 200, … 900)
Combining = stem + insert "ற்" + insert "று" (101–999)
One rule now covers both forms from the same stem table.
| teens_and_ties = teens_ties | ||
|
|
||
| # digit_oru | ||
| one_oru = pynini.cross("1", "ஒரு") | pynini.cross("௧", "ஒரு") |
There was a problem hiding this comment.
let's have everything be files instead of hardcoding
There was a problem hiding this comment.
Fixed and moved to one_oru.tsv file.
| thousand_exact = thousand_stem + pynutil.insert("ம்") | ||
| thousand_prefix = thousand_stem + pynutil.insert("த்து") | ||
|
|
||
| self.digit = digit |
There was a problem hiding this comment.
these don't seem to be used anywhere?
There was a problem hiding this comment.
thousand_exact and thousand_prefix are used (they feed into graph_thousands), so they were kept. self.digit was genuinely unused, so it was removed.
|
|
||
| single_digit = digit | zero | ||
| self.single_digits_graph = single_digit + pynini.closure(insert_space + single_digit) | ||
| zero_del = pynutil.add_weight(pynutil.delete(NEMO_ALL_ZERO), -0.1) |
There was a problem hiding this comment.
is this weight absolutely necessary?
There was a problem hiding this comment.
Not necessary, and it has been removed.
| self.graph_thousands = graph_thousands | ||
| tails = [single_digit, teens_ties, graph_hundreds, graph_thousands] | ||
|
|
||
| # TEN-THOUSANDS (10^4): stem + ஆயிரம் |
There was a problem hiding this comment.
these should also be in tsv files. the process also repeats for graph_ten_thousands, graph_lakhs and graph_ten_lakhs so it could be compressed
There was a problem hiding this comment.
Compressed into a single add_scale() helper that wraps band() + tail-list append, so the same 3-line pattern isn't repeated for each scale level. Related hardcoded words (ஆயிரம்/ஆயிரத்து, லட்சம்/லட்சத்து) moved into scale.tsv.
| graph_ten_lakhs, # ten-lakhs of crores | ||
| ] | ||
| with open(get_abs_path("data/numbers/crore.tsv"), encoding="utf-8") as f: | ||
| crore_exact_raw, crore_prefix_raw = [line.strip() for line in f if line.strip()] |
There was a problem hiding this comment.
switched to pynini.string_file.
|
|
||
| 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 require any additional punctuation?
There was a problem hiding this comment.
The tagger already covers all Unicode punctuation categories, and Tamil mostly reuses ASCII punctuation, so no additional punctuation is needed.
| escaped_written=$(printf '%s' "$written" | sed 's/\\/\\\\/g') | ||
| denorm_pred=$(echo "$escaped_written" | normalizer_main --config=sparrowhawk_configuration.ascii_proto 2>&1 | tail -n 1 | sed 's/\xC2\xA0/ /g') | ||
|
|
||
| # trim white space |
There was a problem hiding this comment.
remove commented out code not needed
| @@ -0,0 +1,53 @@ | |||
| 4 நான்குகள்~நான்கு நான்குகள் | |||
There was a problem hiding this comment.
does this cover all rule categories included? at the very least I see negative numbers missing
There was a problem hiding this comment.
Yes, it covers all rules, and I’ve added negative numbers and comma-grouped numerals to the test cases
| class VerbalizeFinalFst(GraphFst): | ||
| """ | ||
| Finite state transducer that verbalizes an entire sentence, e.g. | ||
| tokens { name: "its" } tokens { time { hours: "twelve" minutes: "thirty" } } tokens { name: "now" } tokens { name: "." } -> its twelve thirty now . |
There was a problem hiding this comment.
all definitions should be in the language and follow the format of a real output
There was a problem hiding this comment.
Fixed and updated the docstring example with real Tamil input and output.
|
|
||
| self.optional_sign = pynini.cross("negative: \"true\"", "minus ") | ||
| if not deterministic: | ||
| self.optional_sign |= pynini.cross("negative: \"true\"", "negative ") |
There was a problem hiding this comment.
Fixed — replaced the English negative with the Tamil equivalent எதிர்மறை.
| def __init__(self, deterministic: bool = True): | ||
| super().__init__(name="cardinal", kind="verbalize", deterministic=deterministic) | ||
|
|
||
| self.optional_sign = pynini.cross("negative: \"true\"", "minus ") |
There was a problem hiding this comment.
Fixed — replaced the English minus with the Tamil equivalent கழித்தல்.
| self.optional_sign = pynini.cross("negative: \"true\"", "minus ") | ||
| if not deterministic: | ||
| self.optional_sign |= pynini.cross("negative: \"true\"", "negative ") | ||
| self.optional_sign |= pynini.cross("negative: \"true\"", "dash ") |
There was a problem hiding this comment.
Fixed — replaced the English dash with the Tamil equivalent கோடுகுறி.
|
please make sure that all new directories have init files |
Signed-off-by: surendran-246 <surendrans@nvidia.com>
for more information, see https://pre-commit.ci
|
Thanks for the review, @mgrafu. Addressed all the feedback comments. Testing: Cardinal pytest passed; Sparrowhawk TNCardinal passed. |
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>
for more information, see https://pre-commit.ci
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) 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.PR Type:
If you haven't finished some of the above items you can still open "Draft" PR.