修改mathpix识别文本处理的一个bug, 并自动将"针角"改为"钝角"
This commit is contained in:
parent
ad18d04029
commit
03a04a5d7b
|
|
@ -933,6 +933,7 @@ def GenerateLessonPreparation(notetitle, outputdir, adict, prodict, objdict, les
|
|||
def getCopy(): # 获取剪切板内容
|
||||
wc.OpenClipboard()
|
||||
t = wc.GetClipboardData(win32con.CF_UNICODETEXT)
|
||||
t = t.replace("\r\n","\n")
|
||||
wc.CloseClipboard()
|
||||
return t
|
||||
|
||||
|
|
@ -946,7 +947,7 @@ def setCopy(string): # 写入剪切板内容
|
|||
def RefineMathpix(raw_string): # 进一步修改mathpix得到的字符串
|
||||
puctuationsfulltosemi = {" ": " ","。": ". ",".": ". ",",": ", ",":": ": ",";": "; ","(": "(",")": ")","?": "? ","“": "``","”": "''", "【": "[", "】": "]"}
|
||||
replacestrings = {r"\\overparen": r"\\overset\\frown", "eqslant": "eq", r"\\vec": r"\\overrightarrow ", r"\\bar": r"\\overline", r"\\lim": r"\\displaystyle\\lim", r"\\sum":r"\\displaystyle\\sum", r"\\prod":r"\\displaystyle\\prod", r"\\mid":"|", r"\^\{\\prime\}":"'",r"e\^":r"\\mathrm{e}^"}
|
||||
wrongrecog = {"雉":"锥","[粗秿]圆":"椭圆","投郑":"投掷","抛郑":"抛掷","范目":"范围","揷":"插","末见":"未见","末成":"未成"}
|
||||
wrongrecog = {"雉":"锥","[粗秿]圆":"椭圆","投郑":"投掷","抛郑":"抛掷","范目":"范围","揷":"插","末见":"未见","末成":"未成","针角":"钝角"}
|
||||
string = raw_string
|
||||
string = re.sub(r"\\left(?:\.?)|\\right(?:\.?)","",string) #删去括号前的\left与\right标记
|
||||
for s in puctuationsfulltosemi:
|
||||
|
|
|
|||
Reference in New Issue