Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 26, 2024
1 parent 30e462f commit 6afcc2a
Show file tree
Hide file tree
Showing 34 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,4 @@ def delete_word(self, word: str):
if len(word) > 0:
delete_graph |= pynutil.delete(word[0].upper() + word[1:])

return delete_graph.optimize()
return delete_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ def __init__(self, cardinal: GraphFst, input_case: str = INPUT_LOWER_CASED):
final_graph |= capitalized_input_graph(final_graph)

final_graph = self.add_tokens(final_graph)
self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,4 @@ def __init__(self, input_case: str = INPUT_LOWER_CASED):
graph = capitalized_input_graph(graph, capitalized_graph_weight=MIN_POS_WEIGHT)

final_graph = self.add_tokens(graph)
self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,4 @@ def __init__(self, input_case: str = INPUT_LOWER_CASED):
graph |= capitalized_input_graph(graph)

final_graph = self.add_tokens(graph)
self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@ def __init__(self):
) | (pynutil.insert("integer: \"") + graph + pynutil.insert("\""))

final_graph = self.add_tokens(final_graph)
self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ def __init__(self, cardinal: GraphFst):
)

final_graph = self.add_tokens(final_graph)
self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ def __init__(self, cardinal: GraphFst, decimal: GraphFst):
final_graph = graph_regular_fractions | graph_integer_fraction_sign

final_graph = self.add_tokens(final_graph)
self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ def __init__(self, cardinal: GraphFst):
)

final_graph = self.add_tokens(integer_component)
self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ def __init__(
fullwidth_to_halfwidth_graph = pynini.string_file(get_abs_path('data/char/fullwidth_to_halfwidth.tsv'))
graph @= pynini.cdrewrite(fullwidth_to_halfwidth_graph, '', '', NEMO_SIGMA)

self.fst = graph.optimize()
self.fst = graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ def __init__(self):
graph = graph_regular | era_component

final_graph = self.delete_tokens(graph)
self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ def __init__(self):

final_graph = self.delete_tokens(regular_graph)

self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ def get_punct_postprocess_graph(self):

graph = remove_space_around_single_quote.optimize()

return graph
return graph
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ def __init__(
tag_oov_graph = pynutil.insert(ltag) + oov_charset + pynutil.insert(rtag)
graph @= pynini.cdrewrite(tag_oov_graph, "", "", NEMO_SIGMA).optimize()

self.fst = graph.optimize()
self.fst = graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ def __init__(self):
final_graph = graph

final_graph = self.delete_tokens(final_graph.optimize())
self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ def __init__(self):
graph = (
cardinal_graph | date_graph | time_graph | ordinal_graph | decimal_graph | fraction_graph | whitelist_graph
)
self.fst = graph
self.fst = graph
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ def __init__(self, deterministic: bool = True, cache_dir: str = None, overwrite_

self.fst = (verbalizer @ postprocessor.fst).optimize()
if far_file:
generator_main(far_file, {"verbalize": self.fst})
generator_main(far_file, {"verbalize": self.fst})
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ def __init__(self, cardinal: GraphFst):
final_graph |= optional_graph_negative + quantity_graph

final_graph = self.add_tokens(final_graph)
self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ def __init__(self):

final_graph = graph
final_graph = self.add_tokens(final_graph)
self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ def augment_labels_with_punct_at_end(labels):
if len(label) > 1:
if label[0][-1] == "." and label[1][-1] != ".":
res.append([label[0], label[1] + "."] + label[2:])
return res
return res
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ def __init__(self):
)

delete_tokens = self.delete_tokens(graph)
self.fst = delete_tokens.optimize()
self.fst = delete_tokens.optimize()
2 changes: 1 addition & 1 deletion nemo_text_processing/text_normalization/en/graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,4 @@ def delete_tokens(self, fst) -> "pynini.FstLike":
+ delete_space
+ pynutil.delete("}")
)
return res @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", NEMO_SIGMA)
return res @ pynini.cdrewrite(pynini.cross("\u00A0", " "), "", "", NEMO_SIGMA)
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@ def __init__(self, cardinal: GraphFst, deterministic: bool = True):

final_graph = self.add_tokens(graph)

self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,4 @@ def __init__(
self.fst = graph.optimize()

if far_file:
generator_main(far_file, {"tokenize_and_classify": self.fst})
generator_main(far_file, {"tokenize_and_classify": self.fst})
2 changes: 1 addition & 1 deletion nemo_text_processing/text_normalization/es/graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,4 @@ def _load_roman(file: str, upper_casing: bool):
)
).optimize()

return graph @ fst
return graph @ fst
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ def __init__(self, deterministic: bool = True):
self.graph = graph

final_graph = self.add_tokens(self.graph + pynutil.insert(" preserve_order: true"))
self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ def __init__(
self.fst_no_digits = pynini.compose(self.fst, no_digits).optimize()

if far_file:
generator_main(far_file, {"tokenize_and_classify": self.fst})
generator_main(far_file, {"tokenize_and_classify": self.fst})
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ def __init__(self, cardinal: GraphFst, deterministic: bool = True, lm: bool = Fa
)

final_graph = self.add_tokens(graph)
self.fst = final_graph.optimize()
self.fst = final_graph.optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ def __init__(
self.fst = tagger

if far_file:
generator_main(far_file, {"tokenize_and_classify": self.fst})
generator_main(far_file, {"tokenize_and_classify": self.fst})
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ def __init__(self, deterministic: bool = True, lm: bool = False):
super().__init__(name="char", kind="verbalize", deterministic=deterministic)

graph = pynutil.delete("name: \"") + NEMO_NOT_QUOTE + pynutil.delete("\"")
self.fst = graph.optimize()
self.fst = graph.optimize()
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ setuptools>=65.5.1
tqdm>=4.41.0
transformers
wget
wrapt
wrapt
2 changes: 1 addition & 1 deletion requirements/requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ sphinx
sphinxcontrib-bibtex
wandb
wget
wrapt
wrapt
2 changes: 1 addition & 1 deletion tests/nemo_text_processing/mr/test_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ class TestDate:
@pytest.mark.unit
def test_denorm(self, test_input, expected):
pred = self.inverse_normalizer_mr.inverse_normalize(test_input, verbose=False)
assert pred == expected
assert pred == expected
2 changes: 1 addition & 1 deletion tools/text_processing_deployment/pynini_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,10 @@ def parse_args():
from nemo_text_processing.text_normalization.ja.taggers.tokenize_and_classify import (
ClassifyFst as TNClassifyFst,
)
from nemo_text_processing.text_normalization.ja.verbalizers.verbalize import VerbalizeFst as TNVerbalizeFst
from nemo_text_processing.text_normalization.ja.verbalizers.post_processing import (
PostProcessingFst as TNPostProcessingFst,
)
from nemo_text_processing.text_normalization.ja.verbalizers.verbalize import VerbalizeFst as TNVerbalizeFst
elif args.language == 'rw':
from nemo_text_processing.text_normalization.rw.taggers.tokenize_and_classify import (
ClassifyFst as TNClassifyFst,
Expand Down

0 comments on commit 6afcc2a

Please sign in to comment.