Skip to content

Commit d7f850b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 21a70e1 commit d7f850b

File tree

191 files changed

+923
-450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+923
-450
lines changed

nemo_text_processing/fst_alignment/alignment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def parse_args():
9696

9797

9898
EPS = "<eps>"
99-
WHITE_SPACE = "\u23B5"
99+
WHITE_SPACE = "\u23b5"
100100
ITN_MODE = "itn"
101101
TN_MODE = "tn"
102102
tn_item_special_chars = ["$", "\\", ":", "+", "-", "="]

nemo_text_processing/hybrid/utils.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ def remove_punctuation(text: str, remove_spaces=True, do_lower=True, lang="en",
482482

483483
text = re.sub(r" +", " ", text)
484484
if remove_spaces:
485-
text = text.replace(" ", "").replace("\u00A0", "").strip()
485+
text = text.replace(" ", "").replace("\u00a0", "").strip()
486486

487487
if do_lower:
488488
text = text.lower()
@@ -515,7 +515,11 @@ def _relax_diff(text):
515515
return acceptable
516516

517517

518-
def get_labels(targets: List[str], norm_texts_weights: List[Tuple[str, str]], lang="en",) -> List[List[str]]:
518+
def get_labels(
519+
targets: List[str],
520+
norm_texts_weights: List[Tuple[str, str]],
521+
lang="en",
522+
) -> List[List[str]]:
519523
"""
520524
Assign labels to generated normalization options (1 - for ground truth, 0 - other options)
521525
Args:
@@ -605,7 +609,14 @@ def print_df(df):
605609
prints data frame
606610
"""
607611
with pd.option_context(
608-
"display.max_rows", None, "display.max_columns", None, "display.width", 1000, "display.max_colwidth", 400,
612+
"display.max_rows",
613+
None,
614+
"display.max_columns",
615+
None,
616+
"display.width",
617+
1000,
618+
"display.max_colwidth",
619+
400,
609620
):
610621
print(df)
611622

nemo_text_processing/inverse_text_normalization/ar/taggers/cardinal.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ def __init__(self, tn_cardinal):
3333
self.graph = pynini.invert(tn_cardinal.cardinal_numbers).optimize()
3434

3535
optional_minus_graph = pynini.closure(
36-
pynutil.insert("negative: ") + pynini.cross("سالب", '"-"') + NEMO_SPACE, 0, 1,
36+
pynutil.insert("negative: ") + pynini.cross("سالب", '"-"') + NEMO_SPACE,
37+
0,
38+
1,
3739
)
3840

3941
final_graph = optional_minus_graph + pynutil.insert('integer: "') + self.graph + pynutil.insert('"')

nemo_text_processing/inverse_text_normalization/ar/taggers/decimal.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ def __init__(self, tn_decimal):
3636
super().__init__(name="decimal", kind="classify")
3737

3838
optional_graph_negative = pynini.closure(
39-
pynutil.insert("negative: ") + pynini.cross("سالب", '"true"') + delete_extra_space, 0, 1,
39+
pynutil.insert("negative: ") + pynini.cross("سالب", '"true"') + delete_extra_space,
40+
0,
41+
1,
4042
)
4143

4244
graph_fractional_part = pynini.invert(tn_decimal.graph_fractional).optimize()

nemo_text_processing/inverse_text_normalization/ar/verbalizers/word.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ def __init__(self):
2727
super().__init__(name="word", kind="verbalize")
2828
chars = pynini.closure(NEMO_CHAR - " ", 1)
2929
char = pynutil.delete("name:") + delete_space + pynutil.delete("\"") + chars + pynutil.delete("\"")
30-
graph = char @ pynini.cdrewrite(pynini.cross(u"\u00A0", " "), "", "", NEMO_SIGMA)
30+
graph = char @ pynini.cdrewrite(pynini.cross(u"\u00a0", " "), "", "", NEMO_SIGMA)
3131

3232
self.fst = graph.optimize()

nemo_text_processing/inverse_text_normalization/en/taggers/cardinal.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,10 @@ def __init__(self, input_case: str = INPUT_LOWER_CASED):
207207
+ graph_in_thousands
208208
)
209209

210-
graph = pynini.union((graph_int | graph_ind) + delete_space + graph_hundreds, graph_zero,)
210+
graph = pynini.union(
211+
(graph_int | graph_ind) + delete_space + graph_hundreds,
212+
graph_zero,
213+
)
211214

212215
graph = graph @ pynini.union(
213216
pynutil.delete(pynini.closure("0")) + pynini.difference(NEMO_DIGIT, "0") + pynini.closure(NEMO_DIGIT), "0"

nemo_text_processing/inverse_text_normalization/en/taggers/date.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,11 @@ def __init__(self, ordinal: GraphFst, input_case: str):
165165
+ pynutil.add_weight(year_graph, -YEAR_WEIGHT)
166166
+ pynutil.insert("\"")
167167
)
168-
optional_graph_year = pynini.closure(graph_year, 0, 1,)
168+
optional_graph_year = pynini.closure(
169+
graph_year,
170+
0,
171+
1,
172+
)
169173
graph_mdy = month_graph + (
170174
(delete_extra_space + day_graph) | graph_year | (delete_extra_space + day_graph + graph_year)
171175
)

nemo_text_processing/inverse_text_normalization/en/taggers/decimal.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ def __init__(self, cardinal: GraphFst, input_case: str = INPUT_LOWER_CASED):
9797
point = pynutil.delete("point")
9898

9999
optional_graph_negative = pynini.closure(
100-
pynutil.insert("negative: ") + pynini.cross(MINUS, "\"true\"") + delete_extra_space, 0, 1,
100+
pynutil.insert("negative: ") + pynini.cross(MINUS, "\"true\"") + delete_extra_space,
101+
0,
102+
1,
101103
)
102104

103105
graph_fractional = pynutil.insert("fractional_part: \"") + graph_decimal + pynutil.insert("\"")

nemo_text_processing/inverse_text_normalization/en/taggers/electronic.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@ def __init__(self, input_case: str = INPUT_LOWER_CASED):
106106
delete_extra_space
107107
+ url_symbols
108108
+ delete_extra_space
109-
+ (domain | pynini.closure(accepted_username + delete_extra_space,) + accepted_username)
109+
+ (
110+
domain
111+
| pynini.closure(
112+
accepted_username + delete_extra_space,
113+
)
114+
+ accepted_username
115+
)
110116
)
111117

112118
protocol_default = (

nemo_text_processing/inverse_text_normalization/en/taggers/measure.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ def __init__(self, cardinal: GraphFst, decimal: GraphFst, input_case: str = INPU
5858
graph_unit_plural = pynini.compose(casing_graph, graph_unit_plural).optimize()
5959

6060
optional_graph_negative = pynini.closure(
61-
pynutil.insert("negative: ") + pynini.cross(MINUS, "\"true\"") + delete_extra_space, 0, 1,
61+
pynutil.insert("negative: ") + pynini.cross(MINUS, "\"true\"") + delete_extra_space,
62+
0,
63+
1,
6264
)
6365

6466
unit_singular = convert_space(graph_unit_singular)

0 commit comments

Comments
 (0)