zhuyunfeng commited on
Commit
2c1877a
1 Parent(s): 8555ab4

Update frontend.py

Browse files

Fix potential issues caused by ending with a Chinese comma

Files changed (1) hide show
  1. cosyvoice/cli/frontend.py +2 -2
cosyvoice/cli/frontend.py CHANGED
@@ -118,10 +118,10 @@ class CosyVoiceFrontEnd:
118
  text = text.replace("\n", "")
119
  text = replace_blank(text)
120
  text = replace_corner_mark(text)
121
- text = text.replace(".", "")
122
  text = text.replace(" - ", ",")
123
  text = remove_bracket(text)
124
- text = re.sub(r'[,,]+$', '。', text)
125
  texts = list(split_paragraph(text, partial(self.tokenizer.encode, allowed_special=self.allowed_special), "zh", token_max_n=80,
126
  token_min_n=60, merge_len=20, comma_split=False))
127
  else:
 
118
  text = text.replace("\n", "")
119
  text = replace_blank(text)
120
  text = replace_corner_mark(text)
121
+ text = text.replace(".", "")
122
  text = text.replace(" - ", ",")
123
  text = remove_bracket(text)
124
+ text = re.sub(r'[,,、]+$', '。', text)
125
  texts = list(split_paragraph(text, partial(self.tokenizer.encode, allowed_special=self.allowed_special), "zh", token_max_n=80,
126
  token_min_n=60, merge_len=20, comma_split=False))
127
  else: