We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 60576cb commit f202e23Copy full SHA for f202e23
apps/common/utils/split_model.py
@@ -167,11 +167,10 @@ def parse_level(text, pattern: str):
167
level_content_list = list(map(to_tree_obj, [r[0:255] for r in re_findall(pattern, text) if r is not None]))
168
# 过滤掉空标题或只包含#和空白字符的标题
169
filtered_list = [item for item in level_content_list
170
- if item['content'].strip() and item['content'].replace('#', '').strip()]
+ if item['content'].strip(' ') and item['content'].replace('#', '').strip(' ')]
171
return list(map(filter_special_symbol, filtered_list))
172
173
174
-
175
def re_findall(pattern, text):
176
# 检查 pattern 是否为空或无效
177
if pattern is None:
@@ -305,8 +304,8 @@ def smart_split_paragraph(content: str, limit: int):
305
304
# 优先级:句号 > 感叹号/问号 > 回车
306
split_chars = [
307
('。', 0), ('.', 0), # 中英文句号
308
- ('!', 0), ('!', 0), # 中英文感叹号
309
- ('?', 0), ('?', 0), # 中英文问号
+ ('!', 0), ('!', 0), # 中英文感叹号
+ ('?', 0), ('?', 0), # 中英文问号
310
]
311
312
# 从后往前找分割点
0 commit comments