12.2 清理bug修改
This commit is contained in:
parent
d161965f5d
commit
4c26d9fcd5
@ -1,3 +1,4 @@
|
||||
import os
|
||||
import time
|
||||
from typing import Any, Dict
|
||||
|
||||
@ -88,12 +89,8 @@ class DocMindClient:
|
||||
UtilClient.assert_as_string(error.message)
|
||||
raise
|
||||
|
||||
|
||||
def main():
|
||||
# Configuration
|
||||
file_path=r'C:\Users\Administrator\Desktop\货物标\output1\招标文件(实高电子显示屏)_procurement.pdf'
|
||||
file_name = "test1.pdf" # Ensure the file name includes the extension
|
||||
|
||||
def alipdf2markdown(file_path,output_path):
|
||||
file_name=os.path.basename(file_path)
|
||||
# Initialize DocMind client
|
||||
docmind_client = DocMindClient()
|
||||
|
||||
@ -119,20 +116,22 @@ def main():
|
||||
|
||||
# 提取并连接每个布局的 'markdownContent'
|
||||
try:
|
||||
print(result)
|
||||
layouts = result.get('layouts', [])
|
||||
markdown_contents = [layout.get('markdownContent', '') for layout in layouts]
|
||||
concatenated_markdown = '\n'.join(markdown_contents)
|
||||
|
||||
# 将连接后的 markdown 写入 'extract.txt'
|
||||
with open('extract.txt', 'w', encoding='utf-8') as extract_file:
|
||||
with open(output_path, 'w', encoding='utf-8') as extract_file:
|
||||
extract_file.write(concatenated_markdown)
|
||||
|
||||
print("Markdown 内容已成功提取到 'extract.txt'。")
|
||||
# print("Markdown 内容已成功提取到 'extract.txt'。")
|
||||
except Exception as e:
|
||||
print(f"处理并写入 Markdown 内容失败: {e}")
|
||||
else:
|
||||
print("Job failed. Please check the error logs for more details.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
file_path = r'C:\Users\Administrator\Desktop\货物标\output1\招标文件正文_procurement.pdf'
|
||||
output_path = r'C:\Users\Administrator\Desktop\货物标\extract_files\义务教育学校多媒体.txt'
|
||||
alipdf2markdown(file_path,output_path)
|
@ -1,3 +1,5 @@
|
||||
data=""
|
||||
if "哈哈" in data:
|
||||
print("yes")
|
||||
import os.path
|
||||
|
||||
file_path=r'C:\Users\Administrator\Desktop\货物标\output1\招标文件正文_procurement.pdf'
|
||||
file_name=os.path.basename(file_path)
|
||||
print(file_name)
|
@ -431,7 +431,7 @@ def get_technical_requirements(file_path,invalid_path,processed_filepath):
|
||||
# user_query_template = "请你根据该货物标中采购要求部分的内容,请你给出\"{}\"的技术参数(或采购要求),请以json格式返回结果,外层键名为\"{}\", 键值对中的键是你对该要求的总结,而值需要完全与原文保持一致,不可擅自总结删减。"
|
||||
user_query_template = """请根据货物标中采购要求部分的内容,告诉我\"{}\"的技术参数或采购要求是什么。请以 JSON 格式返回结果,键名为\"{}\",键值为一个列表,列表中包含若干描述\"{}\"的技术参数或采购要求的字符串,请按原文内容回答,保留三角▲、五角★和序号,不可擅自增删内容,尤其是不可擅自添加序号。
|
||||
要求与指南:
|
||||
1. 如果该货物没有相关采购要求或技术参数要求,键值应为空列表。
|
||||
1. 如果该货物没有相关采购要求或技术参数要求,键值应为空列表[]。
|
||||
2. 如果存在嵌套结构,且原文为Markdown 的表格语法,如'摄像机|有效像素|≥900W像素', 请不要返回该Markdown语法,而是使用冒号':'将相关信息拼接在一起,生成一条完整且清晰的技术参数(或采购要求)描述,作为列表中的一个字符串。如"摄像机:有效像素:≥900W像素"。
|
||||
3. 字符串中的内容为具体的技术参数要求或采购要求,请不要返回诸如'(1)高清录像功能'这种标题性质且不能体现要求的内容。
|
||||
4. 你的键值应该全面,对于同一个单元格内的数据,尽量全面,不要遗漏,对于单元格内以序号分隔的各条参数要求,请分别添加进键值(即字符串列表)中。
|
||||
|
Loading…
x
Reference in New Issue
Block a user