diff --git a/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py b/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py index f04a63d..68dc4fa 100644 --- a/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py +++ b/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py @@ -72,9 +72,12 @@ class TextPreprocessor: def pre_seg_text(self, text:str, lang:str, text_split_method:str): text = text.strip("\n") #防止text成为空字符串 + #如果字符里面没有文字,视其为空字符串 + if not re.sub('\W','', text): + text ='' if text: if (text[0] not in splits and len(get_first(text)) < 4): - text = text + "。" if lang != "en" else text + "." + text = "。" + text if lang != "en" else "." + text print(i18n("实际输入的目标文本:")) print(text)