mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-10-07 23:48:48 +08:00
update
This commit is contained in:
parent
61a6dfeeed
commit
1babc889b9
@ -323,6 +323,7 @@ def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language,
|
|||||||
if (prompt_text[-1] not in splits): prompt_text += "。" if prompt_language != "en" else "."
|
if (prompt_text[-1] not in splits): prompt_text += "。" if prompt_language != "en" else "."
|
||||||
print(i18n("实际输入的参考文本:"), prompt_text)
|
print(i18n("实际输入的参考文本:"), prompt_text)
|
||||||
text = text.strip("\n")
|
text = text.strip("\n")
|
||||||
|
text = replace_consecutive_punctuation(text)
|
||||||
if (text[0] not in splits and len(get_first(text)) < 4): text = "。" + text if text_language != "en" else "." + text
|
if (text[0] not in splits and len(get_first(text)) < 4): text = "。" + text if text_language != "en" else "." + text
|
||||||
|
|
||||||
print(i18n("实际输入的目标文本:"), text)
|
print(i18n("实际输入的目标文本:"), text)
|
||||||
@ -534,7 +535,6 @@ def process_text(texts):
|
|||||||
if all(text in [None, " ", "\n",""] for text in texts):
|
if all(text in [None, " ", "\n",""] for text in texts):
|
||||||
raise ValueError(i18n("请输入有效文本"))
|
raise ValueError(i18n("请输入有效文本"))
|
||||||
for text in texts:
|
for text in texts:
|
||||||
text = replace_consecutive_punctuation(text)
|
|
||||||
if text in [None, " ", ""]:
|
if text in [None, " ", ""]:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@ -544,8 +544,8 @@ def process_text(texts):
|
|||||||
|
|
||||||
def replace_consecutive_punctuation(text):
|
def replace_consecutive_punctuation(text):
|
||||||
punctuations = ''.join(re.escape(p) for p in punctuation)
|
punctuations = ''.join(re.escape(p) for p in punctuation)
|
||||||
pattern = f'[{punctuations}]{{2,}}'
|
pattern = f'([{punctuations}])([{punctuations}])+'
|
||||||
result = re.sub(pattern, '.', text)
|
result = re.sub(pattern, r'\1', text)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user