From bde767dad846ea130bf52d398265ecd2242ebb24 Mon Sep 17 00:00:00 2001 From: Erythrocyte3803 <2544390577@qq.com> Date: Mon, 29 Jan 2024 13:02:25 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=89=E6=8B=A9=E6=8C=89?= =?UTF-8?q?=E7=85=A7=E6=A0=87=E7=82=B9=E7=AC=A6=E5=8F=B7=E5=88=86=E5=8F=A5?= =?UTF-8?q?=E6=97=B6=E5=80=99=EF=BC=8C=E5=A6=82=E6=9E=9C=E5=90=88=E6=88=90?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E4=B8=AD=E5=8F=A5=E5=B0=BE=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=A0=87=E7=82=B9=E7=AC=A6=E5=8F=B7=E5=B0=B1=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GPT_SoVITS/inference_webui.py | 5 ++++- gweight.txt | 1 + sweight.txt | 1 + test.py | 17 +++++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gweight.txt create mode 100644 sweight.txt create mode 100644 test.py diff --git a/GPT_SoVITS/inference_webui.py b/GPT_SoVITS/inference_webui.py index a3531a69..3a1d62cd 100644 --- a/GPT_SoVITS/inference_webui.py +++ b/GPT_SoVITS/inference_webui.py @@ -246,7 +246,6 @@ def nonen_clean_text_inf(text, language): return phones, word2ph, norm_text - def nonen_get_bert_inf(text, language): textlist, langlist = splite_en_inf(text, language) print(textlist) @@ -446,6 +445,8 @@ def cut4(inp): return "\n".join(["%s." % item for item in inp.strip(".").split(".")]) def cut5(inp): + if not re.search(r'[^\w\s]', inp[-1]): + inp += '。' inp = inp.strip("\n") punds = r'[、,。?!;:]' items = re.split(f'({punds})', inp) @@ -454,6 +455,8 @@ def cut5(inp): return opt def cut6(inp): + if not re.search(r'[^\w\s]', inp[-1]): + inp += '.' inp = inp.strip("\n") punds = r'[,.;?!]' items = re.split(f'({punds})', inp) diff --git a/gweight.txt b/gweight.txt new file mode 100644 index 00000000..6a330d58 --- /dev/null +++ b/gweight.txt @@ -0,0 +1 @@ +GPT_weights/na_xi_da-e50.ckpt \ No newline at end of file diff --git a/sweight.txt b/sweight.txt new file mode 100644 index 00000000..3765f316 --- /dev/null +++ b/sweight.txt @@ -0,0 +1 @@ +SoVITS_weights/na_xi_da_e20_s2020.pth \ No newline at end of file diff --git a/test.py b/test.py new file mode 100644 index 00000000..7ad88214 --- /dev/null +++ b/test.py @@ -0,0 +1,17 @@ +import re + +def add_period(text): + if not re.search(r'[^\w\s]', text[-1]): + text += '。' + return text + +def cut5(inp): + inp = add_period(inp) + inp = inp.strip("\n") + punds = r'[、,。?!;:]' + items = re.split(f'({punds})', inp) + items = ["".join(group) for group in zip(items[::2], items[1::2])] + opt = "\n".join(items) + return opt + +print(cut5("测试")) \ No newline at end of file