From 3a4281f4959534b1bf5d01acf0085f4f8e6f2ec8 Mon Sep 17 00:00:00 2001
From: wuhongsheng <664116298@qq.com>
Date: 星期五, 05 七月 2024 00:55:32 +0800
Subject: [PATCH] 优化speakid和语句匹配逻辑,部分解决speakid不从0递增问题 (#1870)

---
 fun_text_processing/text_normalization/en/verbalizers/cardinal.py |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/fun_text_processing/text_normalization/en/verbalizers/cardinal.py b/fun_text_processing/text_normalization/en/verbalizers/cardinal.py
index 70bf202..0f0c08e 100644
--- a/fun_text_processing/text_normalization/en/verbalizers/cardinal.py
+++ b/fun_text_processing/text_normalization/en/verbalizers/cardinal.py
@@ -1,7 +1,9 @@
-
-
 import pynini
-from fun_text_processing.text_normalization.en.graph_utils import DAMO_NOT_QUOTE, GraphFst, delete_space
+from fun_text_processing.text_normalization.en.graph_utils import (
+    DAMO_NOT_QUOTE,
+    GraphFst,
+    delete_space,
+)
 from pynini.lib import pynutil
 
 
@@ -18,14 +20,14 @@
     def __init__(self, deterministic: bool = True):
         super().__init__(name="cardinal", kind="verbalize", deterministic=deterministic)
 
-        self.optional_sign = pynini.cross("negative: \"true\"", "minus ")
+        self.optional_sign = pynini.cross('negative: "true"', "minus ")
         if not deterministic:
-            self.optional_sign |= pynini.cross("negative: \"true\"", "negative ")
+            self.optional_sign |= pynini.cross('negative: "true"', "negative ")
         self.optional_sign = pynini.closure(self.optional_sign + delete_space, 0, 1)
 
         integer = pynini.closure(DAMO_NOT_QUOTE)
 
-        self.integer = delete_space + pynutil.delete("\"") + integer + pynutil.delete("\"")
+        self.integer = delete_space + pynutil.delete('"') + integer + pynutil.delete('"')
         integer = pynutil.delete("integer:") + self.integer
 
         self.numbers = self.optional_sign + integer

--
Gitblit v1.9.1