From 0bfba12fb7f1e7f0524bbfa385569bd10699c23e Mon Sep 17 00:00:00 2001 From: HuangHai <10402852@qq.com> Date: Mon, 30 Jun 2025 19:08:15 +0800 Subject: [PATCH] 'commit' --- dsRag/Test/TestPandoc.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/dsRag/Test/TestPandoc.py b/dsRag/Test/TestPandoc.py index 623e14ff..4cb01dd7 100644 --- a/dsRag/Test/TestPandoc.py +++ b/dsRag/Test/TestPandoc.py @@ -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) \ No newline at end of file + print(x)