Skip to content

Commit eb94c53

Browse files
authored
[fix] remove punc in measure (#227)
1 parent 1cc94f2 commit eb94c53

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

tn/english/rules/measure.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ def build_tagger(self):
9797
unit_plural = (
9898
pynutil.insert(" units: \"") +
9999
(graph_unit_plural + optional_graph_unit2 | graph_unit2) +
100-
self.PUNCT.ques + pynutil.insert("\""))
100+
pynutil.insert("\""))
101101

102102
unit_singular = (pynutil.insert(" units: \"") +
103103
(graph_unit + optional_graph_unit2 | graph_unit2) +
104-
self.PUNCT.ques + pynutil.insert("\""))
104+
pynutil.insert("\""))
105105

106106
decimal = Decimal(self.deterministic)
107107
subgraph_decimal = (optional_graph_negative +
@@ -112,8 +112,7 @@ def build_tagger(self):
112112
subgraph_decimal |= (decimal.final_graph_wo_negative +
113113
pynini.accep(' ').ques +
114114
pynutil.insert(" units: \"") +
115-
pynini.union("AM", "FM") + self.PUNCT.ques +
116-
pynutil.insert("\""))
115+
pynini.union("AM", "FM") + pynutil.insert("\""))
117116

118117
subgraph_cardinal = (
119118
optional_graph_negative + pynutil.insert("integer: \"") +
@@ -129,20 +128,19 @@ def build_tagger(self):
129128
pynutil.insert("integer: \"-\" units: \"") +
130129
((pynini.cross("/", "per") + self.DELETE_ZERO_OR_ONE_SPACE) |
131130
(pynini.accep("per") + pynutil.delete(" "))) +
132-
pynutil.insert(" ") + graph_unit + self.PUNCT.ques + # noqa
133-
pynutil.insert("\"")) # noqa
131+
pynutil.insert(" ") + graph_unit + pynutil.insert("\"")) # noqa
134132

135133
decimal_dash_alpha = (decimal.final_graph_wo_negative +
136134
pynini.cross('-', '') +
137135
pynutil.insert(" units: \"") +
138-
pynini.closure(self.ALPHA, 1) + self.PUNCT.ques +
136+
pynini.closure(self.ALPHA, 1) +
139137
pynutil.insert("\""))
140138

141139
decimal_times = (decimal.final_graph_wo_negative +
142140
pynutil.insert(" units: \"") +
143141
(pynini.cross(pynini.union('x', "X"), 'x')
144142
| pynini.cross(pynini.union('x', "X"), ' times')) +
145-
self.PUNCT.ques + pynutil.insert("\""))
143+
pynutil.insert("\""))
146144

147145
alpha_dash_decimal = (pynutil.insert("units: \"") +
148146
pynini.closure(self.ALPHA, 1) +
@@ -155,7 +153,7 @@ def build_tagger(self):
155153

156154
address = self.get_address_graph(cardinal)
157155
address = (pynutil.insert("units: \"address\" integer: \"") + address +
158-
self.PUNCT.ques + pynutil.insert("\""))
156+
pynutil.insert("\""))
159157

160158
math_operations = pynini.string_file(
161159
get_abs_path("english/data/measure/math_operation.tsv"))

0 commit comments

Comments
 (0)