From b06900d42379555fdd99ee9c5e180a623340f4ad Mon Sep 17 00:00:00 2001 From: xingchensong Date: Tue, 4 Jun 2024 18:12:17 +0800 Subject: [PATCH] [fix] remove punc in decimal --- tn/english/rules/decimal.py | 9 +++------ tn/english/test/data/normalizer.txt | 1 + 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tn/english/rules/decimal.py b/tn/english/rules/decimal.py index 1df31d7..dfb470f 100644 --- a/tn/english/rules/decimal.py +++ b/tn/english/rules/decimal.py @@ -55,8 +55,7 @@ def get_quantity(decimal: 'pynini.FstLike', else: quantity = quantities res |= (decimal + pynini.closure(pynutil.delete(" "), 0, 1) + - pynutil.insert(" quantity: \"") + quantity + - Processor("tmp").PUNCT.ques + pynutil.insert("\"")) + pynutil.insert(" quantity: \"") + quantity + pynutil.insert("\"")) return res @@ -95,11 +94,9 @@ def build_tagger(self): 1) self.graph_fractional = pynutil.insert( - "fractional_part: \"" - ) + self.graph + self.PUNCT.ques + pynutil.insert("\"") + "fractional_part: \"") + self.graph + pynutil.insert("\"") self.graph_integer = pynutil.insert( - "integer_part: \"" - ) + cardinal_graph + self.PUNCT.ques + pynutil.insert("\"") + "integer_part: \"") + cardinal_graph + pynutil.insert("\"") final_graph_wo_sign = ( pynini.closure(self.graph_integer + pynutil.insert(" "), 0, 1) + point + pynutil.insert(" ") + self.graph_fractional) diff --git a/tn/english/test/data/normalizer.txt b/tn/english/test/data/normalizer.txt index f4a5448..aafff26 100644 --- a/tn/english/test/data/normalizer.txt +++ b/tn/english/test/data/normalizer.txt @@ -1,2 +1,3 @@ this is 12th game, number 256, 2024-05-06, 2021-03-07 31.990 billion. ¾ people like chattts, let's eat at 03:43 p.m. run 10 km, give me $12.345 please, call 123-123-5678-1 Mt Hill "HAHAHA" billion 4 March => this is twelfth game, number two hundred and fifty six, the sixth of may twenty twenty four, the seventh of march twenty twenty one thirty one point nine nine oh billion. three quarters people like chattts, let' s eat at three forty three PM run ten kilometers, give me twelve point three four five dollars please, call one two three, one two three, five six seven eight, one Mt Hill" HAHAHA" billion the fourth of march The National Map, accessed April 1, 2011" Site Description of Koppers Co. From the quartet's recording" Jefferson Friedman: Quartets,"" String Quartet no, Riots again broke out, Atassi resigned, and Syrian independence was deferred until after World War II. 1988 (1988) ( 1988) ( 1988). Starling, Arthur E.( 1988 ). this is 12th game, number 256, 2024-05-06, 2021-03-07 31.990 billion. 3/4 people like chattts Retrieved December 2011. Information on Album" Thepodule.com"" Biography by Amy Hanson". => The National Map, accessed the first of april , twenty eleven" Site Description of Koppers company From the quartet' s recording" Jefferson Friedman: Quartets,"" String Quartet no, Riots again broke out, Atassi resigned, and Syrian independence was deferred until after World War two nineteen eighty eight( nineteen eighty eight )( nineteen eighty eight )( nineteen eighty eight). Starling, Arthur E.( nineteen eighty eight). this is twelfth game, number two fifty six, the sixth of may twenty twenty four, the seventh of march twenty twenty one thirty one point nine nine oh billion. three quarters people like chattts Retrieved december twenty eleven. Information on Album" Thepodule dot com"" Biography by Amy Hanson". +.345" and ".456" "9.456" or 6.7890" => point three four five" and". four hundred and fifty six" " nine point four five six" or six point seven eight nine oh"