11.15 工程标资格审查提示词重改

This commit is contained in:
zy123 2024-11-15 15:44:09 +08:00
parent 3959eb8bfd
commit 41271d741a

View File

@ -185,7 +185,6 @@ def process_nested_data(data):
#生成无结构的数据货物标 #生成无结构的数据货物标
def concatenate_keys_values(section_content): def concatenate_keys_values(section_content):
print("-------------")
print(json.dumps(section_content, ensure_ascii=False, indent=4)) print(json.dumps(section_content, ensure_ascii=False, indent=4))
""" """
将章节内容的键值对拼接成一个字符串列表每个元素为 "key value" 将章节内容的键值对拼接成一个字符串列表每个元素为 "key value"
@ -197,8 +196,28 @@ def concatenate_keys_values(section_content):
list of str: 拼接后的字符串列表 list of str: 拼接后的字符串列表
""" """
concatenated = [] concatenated = []
def get_level(key):
"""
计算给定键的层级
Args:
key (str): 层级键 "30.1.1"
Returns:
int: 层级深度例如 "30.1.1" 的层级为 3
"""
key = key.rstrip('.')
parts = key.split('.')
return len(parts)
for key, value in section_content.items(): for key, value in section_content.items():
concatenated.append(f"{key} {value}") level = get_level(key)
# 添加缩进一级无缩进二级缩进4个空格三级及以上每多一级加4个空格
indent = ' ' * 4 * (level - 1)
concatenated.append(f"{indent}{key} {value}")
return concatenated return concatenated
#生成无结构的数据工程标,对提取出的若干键值对生成外键为target_value值为列表的新键值对 #生成无结构的数据工程标,对提取出的若干键值对生成外键为target_value值为列表的新键值对