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 Jul 18, 2023
1 parent d6b8ae9 commit 29cd7f6
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 14 deletions.
1 change: 0 additions & 1 deletion nemo_text_processing/text_normalization/fr/taggers/date.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from pynini.lib import pynutil



class DateFst(GraphFst):
# MAKE SURE ANY COMMENTS APPLY TO YOUR LANGUAGE
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@

import pynini
from nemo_text_processing.text_normalization.en.graph_utils import (
delete_space,
insert_space,
NEMO_DIGIT,
NEMO_SIGMA,
NEMO_SPACE,
GraphFst,
delete_space,
insert_space,
)
from nemo_text_processing.text_normalization.fr.utils import get_abs_path
from pynini.lib import pynutil


quantities = pynini.string_file(get_abs_path("data/numbers/quantities.tsv"))
digit = pynini.string_file(get_abs_path("data/numbers/digit.tsv"))
zero = pynini.string_file(get_abs_path("data/numbers/zero.tsv"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ def __init__(self, deterministic: bool = True):

final_graph = self.add_tokens(final_graph)
self.fst = final_graph.optimize()

Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ def __init__(self, cardinal: GraphFst, decimal: GraphFst, deterministic: bool =
final_graph = pynutil.insert("integer_part: \"") + pynini.closure(NEMO_NOT_SPACE, 1) + 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 @@ -13,11 +13,11 @@
# limitations under the License.
import pynini
from nemo_text_processing.text_normalization.en.graph_utils import (
NEMO_NOT_QUOTE,
GraphFst,
delete_preserve_order,
delete_space,
insert_space,
NEMO_NOT_QUOTE,
GraphFst,
)
from pynini.lib import pynutil

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ def __init__(self, deterministic: bool = True):
# A VARIABLE CALLED final_graph WITH AN FST COMPRISED OF ALL THE RULES
final_graph = pynutil.delete("username: \"") + pynini.closure(NEMO_NOT_QUOTE, 1) + pynutil.delete("\"")

self.fst = self.delete_tokens(final_graph).optimize()
self.fst = self.delete_tokens(final_graph).optimize()
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
# limitations under the License.
import pynini
from nemo_text_processing.text_normalization.en.graph_utils import (
insert_space,
NEMO_NOT_QUOTE,
NEMO_SIGMA,
NEMO_SPACE,
GraphFst,
insert_space,
)
from nemo_text_processing.text_normalization.fr.utils import get_abs_path
from pynini.lib import pynutil
Expand Down
6 changes: 5 additions & 1 deletion nemo_text_processing/text_normalization/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,11 @@ def parse_args():
)
parser.add_argument('--output_file', dest="output_file", help="Output file path", type=str)
parser.add_argument(
"--language", help="language", choices=["en", "de", "es", "fr", "hu", "sv", "zh", "ar", "it"], default="en", type=str
"--language",
help="language",
choices=["en", "de", "es", "fr", "hu", "sv", "zh", "ar", "it"],
default="en",
type=str,
)
parser.add_argument(
"--input_case",
Expand Down
2 changes: 1 addition & 1 deletion tests/nemo_text_processing/fr/test_cardinal.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ def test_denorm(self, test_input, expected):
@pytest.mark.unit
def test_norm(self, test_input, expected):
pred = self.normalizer.normalize(test_input, verbose=False)
assert pred in expected
assert pred in expected
2 changes: 1 addition & 1 deletion tests/nemo_text_processing/fr/test_decimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ def test_denorm(self, test_input, expected):
@pytest.mark.unit
def test_norm(self, test_input, expected):
pred = self.normalizer.normalize(test_input, verbose=False)
assert pred == expected
assert pred == expected
2 changes: 1 addition & 1 deletion tests/nemo_text_processing/fr/test_fraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ def test_denorm(self, test_input, expected):
@pytest.mark.unit
def test_norm(self, test_input, expected):
pred = self.normalizer.normalize(test_input, verbose=False)
assert pred == expected
assert pred == expected

0 comments on commit 29cd7f6

Please sign in to comment.