Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions itn/chinese/rules/money.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

from pynini import string_file
from pynini.lib.pynutil import delete, insert
from pynini.lib.pynutil import add_weight, delete, insert

from itn.chinese.rules.cardinal import Cardinal
from tn.processor import Processor
Expand Down Expand Up @@ -42,7 +42,7 @@ def build_tagger(self):
+ number
+ insert('"')
+ insert(' currency: "')
+ (code | symbol)
+ (symbol | add_weight(code, 1))
+ insert('"')
+ insert(' decimal: "')
+ (insert(".") + digit + (delete("毛") | delete("角")) + (digit + delete("分")).ques).ques
Expand Down
8 changes: 2 additions & 6 deletions itn/japanese/rules/cardinal.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,13 @@ def build_tagger(self):
(ten_thousand_minus + accep("兆")).ques
+ ten_thousand_minus
+ accep("億")
+ ten_thousand_minus
+ accep("万").ques
+ ten_thousand_minus.ques
+ (ten_thousand_minus + (accep("万") + ten_thousand_minus.ques).ques).ques
)
| (
ten_thousand_minus
+ accep("兆")
+ (ten_thousand_minus + accep("億")).ques
+ ten_thousand_minus
+ accep("万").ques
+ ten_thousand_minus.ques
+ (ten_thousand_minus + (accep("万") + ten_thousand_minus.ques).ques).ques
)
)
self.big_integer = number | big_integer
Expand Down
13 changes: 0 additions & 13 deletions tn/english/data/whitelist/tts.tsv
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Ph.D. PHD
Hon. honorable
Mt. Mount
Maj. Major
Rev. Reverend
Expand All @@ -15,15 +14,6 @@ HVAC H-vac
SPDR spider
ZIP zip
~ approximately
κ kappa
ω omega
α alpha
ν nu
δ delta
Δ delta
Α alpha
β beta
Β beta
χ chi
Χ chi
ε epsilon
Expand Down Expand Up @@ -1934,16 +1924,13 @@ M. Q. MQ
Mra MRA
MRBs MRB's
MR&LE MR and LE
Mr. mister
M. R. MR
M.R. MR
mRNA MRNA
mRNAs MRNA's
Mrs. misses
MRTs MRT's
Mse MSE
M&S M and S
Ms. miss
M. S. MS
M.S. MS
MSPs MSP's
Expand Down
4 changes: 3 additions & 1 deletion tn/english/rules/cardinal.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ def build_tagger(self):
single_digits_graph_zero = pynini.invert(graph_digit | graph_zero)
single_digits_graph_oh = pynini.invert(graph_digit) | pynini.cross("0", "oh")

self.single_digits_graph = single_digits_graph_zero + (self.INSERT_SPACE + single_digits_graph_zero).star
self.single_digits_graph = pynutil.add_weight(
single_digits_graph_zero + (self.INSERT_SPACE + single_digits_graph_zero).star, 1.0
)
self.single_digits_graph |= single_digits_graph_oh + (self.INSERT_SPACE + single_digits_graph_oh).star

single_digits_graph_with_commas = (
Expand Down
2 changes: 1 addition & 1 deletion tn/english/test/data/whitelist.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Ph.D. => PHD
Hon. => honorable
Hon. => Honorable
Mt. => Mount
Maj. => Major
Rev. => Reverend
Expand Down
Loading