From 28ccfbfc51068a663a80764e14074df5edf2b5ba Mon Sep 17 00:00:00 2001
From: kongdeqiang <kongdeqiang960204@163.com>
Date: 星期五, 13 三月 2026 17:41:41 +0800
Subject: [PATCH] 提交
---
fun_text_processing/text_normalization/ru/verbalizers/verbalize_final.py | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/fun_text_processing/text_normalization/ru/verbalizers/verbalize_final.py b/fun_text_processing/text_normalization/ru/verbalizers/verbalize_final.py
index 841a94e..1e95e86 100644
--- a/fun_text_processing/text_normalization/ru/verbalizers/verbalize_final.py
+++ b/fun_text_processing/text_normalization/ru/verbalizers/verbalize_final.py
@@ -1,4 +1,3 @@
-
import os
import pynini
@@ -17,7 +16,7 @@
class VerbalizeFinalFst(GraphFst):
"""
- Finite state transducer that verbalizes an entire sentence, e.g.
+ Finite state transducer that verbalizes an entire sentence, e.g.
tokens { name: "its" } tokens { time { hours: "12" minutes: "30" } } tokens { name: "now" } -> its 12:30 now
Args:
@@ -27,16 +26,20 @@
overwrite_cache: set to True to overwrite .far files
"""
- def __init__(self, deterministic: bool = True, cache_dir: str = None, overwrite_cache: bool = False):
+ def __init__(
+ self, deterministic: bool = True, cache_dir: str = None, overwrite_cache: bool = False
+ ):
super().__init__(name="verbalize_final", kind="verbalize", deterministic=deterministic)
far_file = None
if cache_dir is not None and cache_dir != "None":
os.makedirs(cache_dir, exist_ok=True)
- far_file = os.path.join(cache_dir, f"ru_tn_{deterministic}_deterministic_verbalizer.far")
+ far_file = os.path.join(
+ cache_dir, f"ru_tn_{deterministic}_deterministic_verbalizer.far"
+ )
if not overwrite_cache and far_file and os.path.exists(far_file):
self.fst = pynini.Far(far_file, mode="r")["verbalize"]
- logging.info(f'VerbalizeFinalFst graph was restored from {far_file}.')
+ logging.info(f"VerbalizeFinalFst graph was restored from {far_file}.")
else:
verbalize = VerbalizeFst().fst
--
Gitblit v1.9.1