mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-05-02 15:56:49 +08:00
在pre_seg_text中加入判断,若text中都是特殊字符,则将其记为空字符串,防止后面复读。
This commit is contained in:
parent
0dd1d38c86
commit
d09022ee6f
@ -72,9 +72,12 @@ class TextPreprocessor:
|
|||||||
def pre_seg_text(self, text:str, lang:str, text_split_method:str):
|
def pre_seg_text(self, text:str, lang:str, text_split_method:str):
|
||||||
text = text.strip("\n")
|
text = text.strip("\n")
|
||||||
#防止text成为空字符串
|
#防止text成为空字符串
|
||||||
|
#如果字符里面没有文字,视其为空字符串
|
||||||
|
if not re.sub('\W','', text):
|
||||||
|
text =''
|
||||||
if text:
|
if text:
|
||||||
if (text[0] not in splits and len(get_first(text)) < 4):
|
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(i18n("实际输入的目标文本:"))
|
||||||
print(text)
|
print(text)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user