Skip to content

Commit 3d5a8c7

Browse files
committed
Fix decade (eg eighties) -> year to conform with protobuf classes
1 parent 1d803aa commit 3d5a8c7

File tree

2 files changed

+4
-4
lines changed
  • nemo_text_processing/text_normalization/fr

2 files changed

+4
-4
lines changed

nemo_text_processing/text_normalization/fr/taggers/date.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __init__(self, cardinal: GraphFst, deterministic: bool = True):
7171
)
7272

7373
# Accepts "70s", "80s", etc
74-
self.fst |= pynutil.insert("date { decade: \"") + eras + pynutil.insert("\" preserve_order: true }")
74+
self.fst |= pynutil.insert("date { year: \"") + eras + pynutil.insert("\" preserve_order: true }")
7575

7676

7777
# Accepts date ranges, "17-18-19 juin" -> date { day: "17" day: "18": day: "19"}

nemo_text_processing/text_normalization/fr/verbalizers/date.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self, deterministic: bool = True):
3939
day = pynutil.delete("day: \"") + pynini.closure(NEMO_NOT_QUOTE, 1) + pynutil.delete("\"")
4040
month = pynutil.delete("month: \"") + pynini.closure(NEMO_NOT_QUOTE, 1) + pynutil.delete("\"")
4141
year = pynutil.delete("year: \"") + pynini.closure(NEMO_NOT_QUOTE, 1) + pynutil.delete("\"")
42-
decade = pynutil.delete("decade: \"") + pynini.closure(NEMO_NOT_QUOTE, 1) + pynutil.delete("\"")
42+
decade = pynutil.delete("year: \"") + pynini.closure(NEMO_NOT_QUOTE, 1) + pynutil.delete("\"")
4343

4444
graph_dmy = day + NEMO_SPACE + month + pynini.closure(NEMO_SPACE + year, 0, 1) + delete_preserve_order
4545
graph_my = month + NEMO_SPACE + year + delete_preserve_order
@@ -60,5 +60,5 @@ def apply_fst(text, fst):
6060
if __name__ == "__main__":
6161
fst = DateFst()
6262

63-
# tagger output for "les 17/18/19 juin"
64-
apply_fst('date { day: "les dix-sept dix-huit dix-neuf" month: "juin" preserve_order: true }', fst.fst)
63+
# tagger output for "eighties"
64+
apply_fst('date { year: "eighties" preserve_order: true }', fst.fst)

0 commit comments

Comments
 (0)