MCPcopy Create free account
hub / github.com/FireRedTeam/FireRedTTS2 / process_text

Function process_text

fireredtts2/utils/spliter.py:259–276  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

257
258
259def process_text(text):
260 chinese_max_limit = 150
261 english_max_limit = 80
262 # 移除开头的标记如[S2]
263 text = re.sub(r"^\[S\d+\]", "", text).strip()
264 is_chinese = contains_chinese(text)
265 if is_chinese:
266 if count_characters_chinese(text) <= chinese_max_limit:
267 return [text]
268 sentences = split_by_punctuation_chinese(text)
269 result = merge_sentences_chinese(sentences, chinese_max_limit)
270 else:
271 if count_words_english(text) <= english_max_limit:
272 return [text]
273 sentences = split_by_punctuation_english(text)
274 result = merge_sentences_english(sentences, english_max_limit)
275
276 return result
277
278
279def process_text_list(text_list):

Callers 1

process_text_listFunction · 0.85

Calls 7

contains_chineseFunction · 0.85
count_characters_chineseFunction · 0.85
merge_sentences_chineseFunction · 0.85
count_words_englishFunction · 0.85
merge_sentences_englishFunction · 0.85

Tested by

no test coverage detected