File size: 431 Bytes
08bfbca | 1 2 3 4 5 6 7 8 9 10 11 12 13 | import re
def preprocess_remove_line_break(raw_text, replacements=""):
# 移除单独换行符
pattern = r"(?<!\n)\n(?!\n)"
text_content = re.sub(pattern, replacements, raw_text)
text_content = text_content.replace("“", "\"")
text_content = text_content.replace("”", "\"")
text_content = text_content.replace("‘", "'")
text_content = text_content.replace("’", "'")
return text_content |