From 746ec9e3ac53dad832a7d9496bd371493cfb0fc9 Mon Sep 17 00:00:00 2001 From: KamioRinn Date: Fri, 27 Jun 2025 11:24:46 +0800 Subject: [PATCH] remove unnecessary code --- GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py | 5 +---- GPT_SoVITS/inference_webui.py | 5 +---- GPT_SoVITS/text/chinese.py | 14 -------------- GPT_SoVITS/text/chinese2.py | 14 -------------- api.py | 5 +---- 5 files changed, 3 insertions(+), 40 deletions(-) diff --git a/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py b/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py index e131d979..ba8233e7 100644 --- a/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py +++ b/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py @@ -143,11 +143,8 @@ class TextPreprocessor: langlist.append(tmp["lang"]) textlist.append(tmp["text"]) elif language == "en": - formattext = text - while " " in formattext: - formattext = formattext.replace(" ", " ") langlist.append("en") - textlist.append(formattext) + textlist.append(text) elif language == "auto": for tmp in LangSegmenter.getTexts(text): langlist.append(tmp["lang"]) diff --git a/GPT_SoVITS/inference_webui.py b/GPT_SoVITS/inference_webui.py index 42b38123..643e4054 100644 --- a/GPT_SoVITS/inference_webui.py +++ b/GPT_SoVITS/inference_webui.py @@ -608,11 +608,8 @@ def get_phones_and_bert(text, language, version, final=False): langlist.append(tmp["lang"]) textlist.append(tmp["text"]) elif language == "en": - formattext = text - while " " in formattext: - formattext = formattext.replace(" ", " ") langlist.append("en") - textlist.append(formattext) + textlist.append(text) elif language == "auto": for tmp in LangSegmenter.getTexts(text): langlist.append(tmp["lang"]) diff --git a/GPT_SoVITS/text/chinese.py b/GPT_SoVITS/text/chinese.py index ce44215f..944c9cb7 100644 --- a/GPT_SoVITS/text/chinese.py +++ b/GPT_SoVITS/text/chinese.py @@ -181,20 +181,6 @@ def text_normalize(text): return dest_text -# 不排除英文的文本格式化 -def mix_text_normalize(text): - # https://github.com/PaddlePaddle/PaddleSpeech/tree/develop/paddlespeech/t2s/frontend/zh_normalization - tx = TextNormalizer() - sentences = tx.normalize(text) - dest_text = "" - for sentence in sentences: - dest_text += replace_punctuation_with_en(sentence) - - # 避免重复标点引起的参考泄露 - dest_text = replace_consecutive_punctuation(dest_text) - return dest_text - - if __name__ == "__main__": text = "啊——但是《原神》是由,米哈\游自主,研发的一款全.新开放世界.冒险游戏" text = "呣呣呣~就是…大人的鼹鼠党吧?" diff --git a/GPT_SoVITS/text/chinese2.py b/GPT_SoVITS/text/chinese2.py index 612aa3a5..dcce0d96 100644 --- a/GPT_SoVITS/text/chinese2.py +++ b/GPT_SoVITS/text/chinese2.py @@ -326,20 +326,6 @@ def text_normalize(text): return dest_text -# 不排除英文的文本格式化 -def mix_text_normalize(text): - # https://github.com/PaddlePaddle/PaddleSpeech/tree/develop/paddlespeech/t2s/frontend/zh_normalization - tx = TextNormalizer() - sentences = tx.normalize(text) - dest_text = "" - for sentence in sentences: - dest_text += replace_punctuation_with_en(sentence) - - # 避免重复标点引起的参考泄露 - dest_text = replace_consecutive_punctuation(dest_text) - return dest_text - - if __name__ == "__main__": text = "啊——但是《原神》是由,米哈\游自主,研发的一款全.新开放世界.冒险游戏" text = "呣呣呣~就是…大人的鼹鼠党吧?" diff --git a/api.py b/api.py index d9f0bdc4..a14c23bd 100644 --- a/api.py +++ b/api.py @@ -554,11 +554,8 @@ def get_phones_and_bert(text, language, version, final=False): langlist.append(tmp["lang"]) textlist.append(tmp["text"]) elif language == "en": - formattext = text - while " " in formattext: - formattext = formattext.replace(" ", " ") langlist.append("en") - textlist.append(formattext) + textlist.append(text) elif language == "auto": for tmp in LangSegmenter.getTexts(text): langlist.append(tmp["lang"])