Skip to content

Commit e58be4f

Browse files
committed
Resolved the conflicts with mm_yyyy and date ranges and added the previously removed failing test cases.
Signed-off-by: Namrata Gachchi <ngachchi@nvidia.com>
1 parent c51d04a commit e58be4f

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

nemo_text_processing/text_normalization/hi/taggers/date.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def __init__(self, cardinal: GraphFst):
8585
graph_mm_dd_yyyy += pynutil.insert(" preserve_order: true ")
8686

8787
graph_mm_yyyy = (
88-
months_graph + (delete_dash | pynini.accep("")) + years_graph + pynutil.insert(" preserve_order: true ")
88+
months_graph + delete_dash + insert_space + years_graph
8989
)
9090

9191
graph_year_suffix = era_graph
@@ -108,7 +108,7 @@ def __init__(self, cardinal: GraphFst):
108108
| graph_mm_dd
109109
| pynutil.add_weight(graph_dd_mm_yyyy, -0.001)
110110
| graph_mm_dd_yyyy
111-
| graph_mm_yyyy
111+
| pynutil.add_weight(graph_mm_yyyy, -0.2)
112112
| pynutil.add_weight(graph_year_suffix, -0.001)
113113
| pynutil.add_weight(graph_range, -0.005)
114114
)

nemo_text_processing/text_normalization/hi/verbalizers/date.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ def __init__(self):
3939

4040
year = pynutil.delete("year: \"") + pynini.closure(NEMO_NOT_QUOTE, 1) + pynutil.delete("\"")
4141

42-
era = pynutil.delete("era: \"") + pynini.closure(NEMO_NOT_QUOTE, 1) + pynutil.delete("\"")
42+
graph_era = pynutil.delete("era: \"") + pynini.closure(NEMO_NOT_QUOTE, 1) + pynutil.delete("\"")
4343

44-
range = pynutil.delete("text: \"") + pynini.closure(NEMO_NOT_QUOTE, 1) + pynutil.delete("\"")
44+
graph_range = pynutil.delete("text: \"") + pynini.closure(NEMO_NOT_QUOTE, 1) + pynutil.delete("\"")
4545

4646
graph_dd_mm = day + NEMO_SPACE + month
4747

@@ -53,10 +53,6 @@ def __init__(self):
5353

5454
graph_mm_yyyy = month + NEMO_SPACE + year
5555

56-
graph_era = era
57-
58-
graph_range = range
59-
6056
optional_preserve_order = pynini.closure(
6157
pynutil.delete("preserve_order:") + delete_space + pynutil.delete("true") + delete_space
6258
| pynutil.delete("field_order:")

tests/nemo_text_processing/hi/data_text_normalization/test_cases_date.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
१०-२९-२०००~अक्टूबर उनतीस दो हज़ार
1515
११-१४-११००~नवंबर चौदह ग्यारह सौ
1616
०३-२०१०~मार्च दो हज़ार दस
17+
११-२०२४~नवंबर दो हज़ार चौबीस
1718
२०७०~दो हज़ार सत्तर
1819
२०२४~दो हज़ार चौबीस
1920
१२० ई. पू.~एक सौ बीस ईसा पूर्व

0 commit comments

Comments
 (0)