10.25切分改为多线程

This commit is contained in:
zy123 2024-10-25 18:12:12 +08:00
parent e73125f097
commit 55b26fab85
3 changed files with 6 additions and 5 deletions

View File

@ -29,7 +29,7 @@ def format_chinese_date(date_str):
# 2. 使用正则表达式移除所有非数字和非必要的中文字符
# 只保留数字、年、月、日、时、分、秒、冒号、减号
date_str = re.sub(r'[^\d年月日时分秒:\-]', '', date_str)
date_str = re.sub(r'[^\d年月日时分秒:\-]', '', date_str)
# print(f"去除多余字符后: {date_str}")
@ -39,7 +39,7 @@ def format_chinese_date(date_str):
# 4. 替换'年'和'月'为 '-', '日'为 ' ',确保日期和时间之间有一个空格
date_str = date_str.replace('', '-').replace('', '-').replace('', ' ')
# 替换'时'、'分'为 ':',并移除'秒'
date_str = date_str.replace('', ':').replace('', ':').replace('', '')
date_str = date_str.replace('', ':').replace('',':').replace('', ':').replace('', '')
# print(f"替换分隔符后: {date_str}")
@ -109,7 +109,7 @@ def format_chinese_date(date_str):
if __name__ == "__main__":
input_dates = [
# 完整的日期和时间
["www"],
"2021年 6月 18日 15点 00分",
"2019年7月18日0930",
"20 19 年7 月18日 09 30整北京时间",
"2020年02月05日12时30分45秒",

View File

@ -206,6 +206,7 @@ def inner_post_processing(base_info):
return extracted_info
def outer_post_processing(combined_data, includes,good_list):
print(good_list)
"""
外层处理函数调用内层 post_processing 处理 '基础信息'并构建 processed_data
额外提取 '采购要求' 下的 '技术要求' 内容

View File

@ -144,11 +144,11 @@ def post_process_baseinfo(base_info):
"""
try:
# 尝试提取 '货物列表',若中间某个键不存在,返回 good_list=[]
print(json.dumps(base_info,ensure_ascii=False,indent=4))
logger.info("hhhhhhhhhhhhhhhhhh")
logger.info(json.dumps(base_info,ensure_ascii=False,indent=4))
procurement_reqs = base_info.get('采购要求', {})
technical_requirements = procurement_reqs.get('技术要求', {})
good_list = technical_requirements.pop('货物列表', []) # 如果 '货物列表' 不存在,返回 []
logger.info(f"Extracted good_list: {good_list}")
return base_info, good_list
except Exception as e: