Ver Fonte

Merge pull request #133 from zhuzizyf/fix-frontend-bug

Update frontend.py
Xiang Lyu há 1 ano atrás
pai
commit
51c21660f3
1 ficheiros alterados com 2 adições e 0 exclusões
  1. 2 0
      cosyvoice/cli/frontend.py

+ 2 - 0
cosyvoice/cli/frontend.py

@@ -20,6 +20,7 @@ from typing import Callable
 import torchaudio.compliance.kaldi as kaldi
 import torchaudio
 import os
+import re
 import inflect
 try:
     import ttsfrd
@@ -110,6 +111,7 @@ class CosyVoiceFrontEnd:
             text = text.replace(".", "、")
             text = text.replace(" - ", ",")
             text = remove_bracket(text)
+            text = re.sub(r'[,,]+$', '。', text)
             texts = [i for i in 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)]