main
HuangHai 3 weeks ago
parent a0ab4deb3e
commit 0bfba12fb7

@ -7,8 +7,6 @@ import uuid
mtef = r'D:\dsWork\dsProject\dsRag\mtef-go-3\mtef-go.exe'
# docx文件路径
docx_file = 'D:\dsWork\dsProject\dsRag\static\Txt\化学方程式_CHEMISTRY_1.docx'
# 处理完成后的文件路径
t1 = "c:/final.txt"
# 结合Pandoc和mtef-go的结果合并成最终的输出文本
@ -38,7 +36,7 @@ def get_docx_content_by_pandoc(f, formula_list):
# 获取MathType对应的Latex公式
def get_MathType_by_mtef(docx_file):
def getLatexList(docx_file):
res = []
output = os.path.join(os.environ['TEMP'], uuid.uuid4().hex + '.txt')
command = mtef + r" -w " + docx_file + " -o " + output
@ -50,12 +48,12 @@ def get_MathType_by_mtef(docx_file):
if __name__ == '__main__':
# 一、输出MathType对应的Latex公式
formula_list = get_MathType_by_mtef(docx_file)
# print(formula_list)
# 一、获取Latex公式列表
formula_list = getLatexList(docx_file)
# 二、获取docx文件的内容
# 二、整合最终的拼接完的文本
sb = get_docx_content_by_pandoc(docx_file, formula_list)
# 三、输出
for x in sb:
print(x)
print(x)

Loading…
Cancel
Save