This commit is contained in:
2025-07-07 11:25:17 +08:00
parent cfb4f4ea6a
commit b352571e17
10 changed files with 634 additions and 552 deletions
+5 -5
View File
@@ -145,7 +145,7 @@ def xml_to_json(xml_content, output_path):
result.append(base_item)
elif data_sources in project_division:
mapping_desc = f"{index_extraction_scope}项目划分中获取取费费用名称于【{keyword}】的费用"
mapping_desc = f"获取项目划分{index_extraction_scope}下取费名称于【{keyword}】的费用"
base_item["指标描述"] = {
"指标映射": mapping_desc,
"映射规则": parsed["映射规则"]
@@ -162,11 +162,11 @@ def xml_to_json(xml_content, output_path):
# 取数据来源的开头两个字(如"定额"、"清单"等)
temp3 = data_sources[0:2]
if temp3 in ["清单", "定额", "人材机"]:
mapping_desc = f"{index_extraction_scope}及其子孙项目划分中查找编码包含【{temp0}】的所有【{temp3}】的【{temp2}】之和"
mapping_desc = f"获取项目划分{index_extraction_scope}编码包含【{temp0}】的所有【{temp3}】的【{temp2}】之和"
elif temp3 in ["主材", "设备"]:
mapping_desc = f"{index_extraction_scope}】及其子孙项目划分中查找名称包含【{temp0}】的所有【{temp3}】的【{temp2}】之和"
mapping_desc = f"获取项目划分{index_extraction_scope}】及名称包含【{temp0}】的所有【{temp3}】的【{temp2}】之和"
else:
mapping_desc = f"从【{data_sources}】中获取{temp0}属性"
mapping_desc = f"从【{data_sources}】中获取{temp0}"
base_item["指标描述"] = {
"指标映射": mapping_desc,
@@ -221,6 +221,6 @@ def xml_to_json(xml_content, output_path):
return "结果已保存"
xml_content = read_xml_as_string('dataset/主网架空线路造价分析指标.xml')
json_output = xml_to_json(xml_content, output_path= "./tests/zhibiao.json")
json_output = xml_to_json(xml_content, output_path= "./data/zhibiao.json")
print("转换完毕!")