From 2c1877a5d4c10c094df53c956374af16451ea789 Mon Sep 17 00:00:00 2001 From: zhuyunfeng <42790740+zhuzizyf@users.noreply.github.com> Date: Sun, 29 Sep 2024 13:29:28 +0800 Subject: [PATCH] Update frontend.py Fix potential issues caused by ending with a Chinese comma --- cosyvoice/cli/frontend.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cosyvoice/cli/frontend.py b/cosyvoice/cli/frontend.py index 8e12a1c..ac138b1 100644 --- a/cosyvoice/cli/frontend.py +++ b/cosyvoice/cli/frontend.py @@ -118,10 +118,10 @@ class CosyVoiceFrontEnd: text = text.replace("\n", "") text = replace_blank(text) text = replace_corner_mark(text) - text = text.replace(".", "、") + text = text.replace(".", "。") text = text.replace(" - ", ",") text = remove_bracket(text) - text = re.sub(r'[,,]+$', '。', text) + text = re.sub(r'[,,、]+$', '。', text) texts = list(split_paragraph(text, partial(self.tokenizer.encode, allowed_special=self.allowed_special), "zh", token_max_n=80, token_min_n=60, merge_len=20, comma_split=False)) else: