From bdcbc46cb02d300caf4bc2f80f8c35bcc3135ffe Mon Sep 17 00:00:00 2001 From: RVC-Boss <129054828+RVC-Boss@users.noreply.github.com> Date: Sun, 28 Jan 2024 20:22:58 +0800 Subject: [PATCH] Update chinese.py --- GPT_SoVITS/text/chinese.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/GPT_SoVITS/text/chinese.py b/GPT_SoVITS/text/chinese.py index de3ef01..fbcfa50 100644 --- a/GPT_SoVITS/text/chinese.py +++ b/GPT_SoVITS/text/chinese.py @@ -5,13 +5,11 @@ import re import cn2an from pypinyin import lazy_pinyin, Style -import sys - -sys.path.append("/data/docker/liujing04/gpt-vits/gpt-vits-master") - from text.symbols import punctuation from text.tone_sandhi import ToneSandhi +normalizer = lambda x: cn2an.transform(x, "an2cn") + current_file_path = os.path.dirname(__file__) pinyin_to_symbol_map = { line.split("\t")[0]: line.strip().split("\t")[1] @@ -151,10 +149,8 @@ def _g2p(segments): def text_normalize(text): - numbers = re.findall(r"\d+(?:\.?\d+)?", text) - for number in numbers: - text = text.replace(number, cn2an.an2cn(number), 1) - text = replace_punctuation(text) + dest_text=normalizer(text) + text = replace_punctuation(dest_text) return text