From 6e69d784e4814c3dbe35e8f70c6cf4b920c8b20b Mon Sep 17 00:00:00 2001
From: 天地 <tiandiweizun@gmail.com>
Date: 星期三, 19 三月 2025 23:10:13 +0800
Subject: [PATCH] 1. bug fix:list(mean)和list(var),由于mean和var是numpy,导致写入到文件的格式错误,参考上面的话,大概率是list(mean.tolist()),其实外层list没有必要 (#2437)
---
fun_text_processing/inverse_text_normalization/ja/graph_utils.py | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/fun_text_processing/inverse_text_normalization/ja/graph_utils.py b/fun_text_processing/inverse_text_normalization/ja/graph_utils.py
index d645118..644a0ae 100644
--- a/fun_text_processing/inverse_text_normalization/ja/graph_utils.py
+++ b/fun_text_processing/inverse_text_normalization/ja/graph_utils.py
@@ -35,7 +35,9 @@
delete_hyphen = pynutil.delete(pynini.closure("-", 0, 1))
insert_hyphen = pynutil.insert("-")
-TO_LOWER = pynini.union(*[pynini.cross(x, y) for x, y in zip(string.ascii_uppercase, string.ascii_lowercase)])
+TO_LOWER = pynini.union(
+ *[pynini.cross(x, y) for x, y in zip(string.ascii_uppercase, string.ascii_lowercase)]
+)
TO_UPPER = pynini.invert(TO_LOWER)
@@ -65,7 +67,9 @@
Returns output fst where breaking spaces are converted to non breaking spaces
"""
- return fst @ pynini.cdrewrite(pynini.cross(DAMO_SPACE, DAMO_NON_BREAKING_SPACE), "", "", DAMO_SIGMA)
+ return fst @ pynini.cdrewrite(
+ pynini.cross(DAMO_SPACE, DAMO_NON_BREAKING_SPACE), "", "", DAMO_SIGMA
+ )
class GraphFst:
@@ -87,7 +91,9 @@
self.far_path = Path(os.path.dirname(__file__) + "/grammars/" + kind + "/" + name + ".far")
if self.far_exist():
- self._fst = Far(self.far_path, mode="r", arc_type="standard", far_type="default").get_fst()
+ self._fst = Far(
+ self.far_path, mode="r", arc_type="standard", far_type="default"
+ ).get_fst()
def far_exist(self) -> bool:
"""
--
Gitblit v1.9.1