11.15 工程标资格审查提示词重改
This commit is contained in:
parent
3959eb8bfd
commit
41271d741a
@ -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,值为列表的新键值对
|
||||||
|
Loading…
x
Reference in New Issue
Block a user