Skip to content

Commit 63ef4e6

Browse files
committed
replaced text tag with era tag for the date class
Signed-off-by: Namrata Gachchi <ngachchi@nvidia.com>
1 parent 22a2375 commit 63ef4e6

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

nemo_text_processing/text_normalization/hi/taggers/date.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ def __init__(self, cardinal: GraphFst):
9494

9595
# Graph for year
9696
century_number = pynini.compose(pynini.closure(NEMO_HI_DIGIT, 1), cardinal_graph) + pynini.accep("वीं")
97-
century_text = pynutil.insert("text: \"") + century_number + pynutil.insert("\"") + insert_space
97+
century_text = pynutil.insert("era: \"") + century_number + pynutil.insert("\"") + insert_space
9898

9999
# Updated logic to use suffix_union
100100
year_number = graph_year + suffix_union
101-
year_text = pynutil.insert("text: \"") + year_number + pynutil.insert("\"") + insert_space
101+
year_text = pynutil.insert("era: \"") + year_number + pynutil.insert("\"") + insert_space
102102

103103
# Updated logic to use prefix_union
104-
year_prefix = pynutil.insert("text: \"") + prefix_union + insert_space + graph_year + pynutil.insert("\"")
104+
year_prefix = pynutil.insert("era: \"") + prefix_union + insert_space + graph_year + pynutil.insert("\"")
105105

106106
graph_dd_mm_yyyy = (
107107
days_graph + (delete_dash | delete_slash) + months_graph + (delete_dash | delete_slash) + years_graph
@@ -117,10 +117,8 @@ def __init__(self, cardinal: GraphFst):
117117

118118
graph_year_suffix = era_graph
119119

120-
comma_graph = pynutil.insert("text: \"") + delete_comma + insert_space + graph_year + pynutil.insert("\"")
121-
122120
graph_range = (
123-
pynutil.insert("text: \"")
121+
pynutil.insert("era: \"")
124122
+ cardinal_graph
125123
+ insert_space
126124
+ range_graph
@@ -143,7 +141,6 @@ def __init__(self, cardinal: GraphFst):
143141
| pynutil.add_weight(century_text, -0.001)
144142
| pynutil.add_weight(year_text, -0.001)
145143
| pynutil.add_weight(year_prefix, -0.009)
146-
| comma_graph
147144
)
148145

149146
self.final_graph = final_graph.optimize()

nemo_text_processing/text_normalization/hi/taggers/measure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def __init__(self, cardinal: GraphFst, decimal: GraphFst):
6666
quarter_graph = pynutil.insert("integer_part: \"") + quarter + pynutil.insert("\"")
6767

6868
# Define the unit handling
69-
unit = pynutil.insert("units: \"") + unit_graph + pynutil.insert("\" ")
70-
units = pynutil.insert("units: \"") + quarterly_units_graph + pynutil.insert("\" ")
69+
unit = pynutil.insert(" units: \"") + unit_graph + pynutil.insert("\" ")
70+
units = pynutil.insert(" units: \"") + quarterly_units_graph + pynutil.insert("\" ")
7171

7272
# Handling symbols like x, X, *
7373
symbol_graph = pynini.string_map([("x", "बाई"), ("X", "बाई"), ("*", "बाई"),])

0 commit comments

Comments
 (0)