fix: 修复错误的反斜杠应用

This commit is contained in:
Rikki
2025-03-30 07:09:19 +08:00
parent 8374705082
commit 31935e655b

View File

@@ -205,7 +205,7 @@ def split_into_sentences_w_remove_punctuation(text: str) -> List[str]:
else:
# 用"|seg|"作为分割符分开
text = re.sub(r"([.!?]) +", r"\1\|seg\|", text)
text = text.replace("\n", "\|seg\|")
text = text.replace("\n", "|seg|")
text, mapping = protect_kaomoji(text)
# print(f"处理前的文本: {text}")
@@ -246,7 +246,7 @@ def split_into_sentences_w_remove_punctuation(text: str) -> List[str]:
current_sentence += " " + part
else:
# 处理分割符
space_parts = current_sentence.split("\|seg\|")
space_parts = current_sentence.split("|seg|")
current_sentence = space_parts[0]
for part in space_parts[1:]:
new_sentences.append(current_sentence.strip())