CosyVoice commited on
Commit
67f298d
2 Parent(s): 4a1ec98 0b76dfa

Merge pull request #451 from zhuzizyf/bug-fix-split_paragraph

Browse files
Files changed (1) hide show
  1. cosyvoice/utils/frontend_utils.py +8 -5
cosyvoice/utils/frontend_utils.py CHANGED
@@ -80,6 +80,13 @@ def split_paragraph(text: str, tokenize, lang="zh", token_max_n=80, token_min_n=
80
  pounc = ['.', '?', '!', ';', ':']
81
  if comma_split:
82
  pounc.extend([',', ','])
 
 
 
 
 
 
 
83
  st = 0
84
  utts = []
85
  for i, c in enumerate(text):
@@ -92,11 +99,7 @@ def split_paragraph(text: str, tokenize, lang="zh", token_max_n=80, token_min_n=
92
  st = i + 2
93
  else:
94
  st = i + 1
95
- if len(utts) == 0:
96
- if lang == "zh":
97
- utts.append(text + '。')
98
- else:
99
- utts.append(text + '.')
100
  final_utts = []
101
  cur_utt = ""
102
  for utt in utts:
 
80
  pounc = ['.', '?', '!', ';', ':']
81
  if comma_split:
82
  pounc.extend([',', ','])
83
+
84
+ if text[-1] not in pounc:
85
+ if lang == "zh":
86
+ text += "。"
87
+ else:
88
+ text += "."
89
+
90
  st = 0
91
  utts = []
92
  for i, c in enumerate(text):
 
99
  st = i + 2
100
  else:
101
  st = i + 1
102
+
 
 
 
 
103
  final_utts = []
104
  cur_utt = ""
105
  for utt in utts: