diff --git a/工具v2/database_tools.py b/工具v2/database_tools.py index 405e534b..f5f4af7a 100644 --- a/工具v2/database_tools.py +++ b/工具v2/database_tools.py @@ -1360,7 +1360,7 @@ def RefineMathpix(raw_string): # 进一步修改mathpix得到的字符串 string = re.sub(r"\$\$","$",string) #行间公式替换为行内公式 string = re.sub(r"\$\s+\$"," ",string) #删除多余的$符号 string = re.sub(r"([,.:;?!])\$",lambda x:x.group(1)+" $",string) #标点和$符号分开 - string = re.sub(r"\\left\\lvert\\","|",string) #替换|的错误代码 + string = re.sub(r"\\left\\lvert\\,","|",string) #替换|的错误代码 string = re.sub(r"\\frac",r"\\dfrac",string) #替换frac为dfrac string = re.sub(r"\n(?:A\.|\(A\))([\s\S]*?)(?:B\.|\(B\))([\s\S]*?)(?:C\.|\(C\))([\s\S]*?)(?:D\.|\(D\))([\s\S]*?)\n",lambda matchobj: "\n\\fourch{%s}{%s}{%s}{%s}\n"%(matchobj.group(1).strip(),matchobj.group(2).strip(),matchobj.group(3).strip(),matchobj.group(4).strip()),string+"\n\n") # 选择题的选择支处理 string = re.sub(r"[\.;](\}\{|\}\n)",lambda matchobj: matchobj.group(1),string) #去除选择题选项最末尾的句号或分号