(text)
| 257 | |
| 258 | |
| 259 | def 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 | |
| 279 | def process_text_list(text_list): |
no test coverage detected