From d80ac2fd2df4e7fb8a28acfa512bb11472b5cc99 Mon Sep 17 00:00:00 2001
From: liugz18 <57401541+liugz18@users.noreply.github.com>
Date: 星期四, 18 七月 2024 21:34:55 +0800
Subject: [PATCH] Rename 'res' in line 514 to avoid with naming conflict with line 365
---
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