diff --git a/flask_app/general/format_date.py b/flask_app/general/format_date.py index cdc7880..2a731fc 100644 --- a/flask_app/general/format_date.py +++ b/flask_app/general/format_date.py @@ -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日09:30", "20 19 年7 月18日 09: 30整(北京时间)", "2020年02月05日12时30分45秒", diff --git a/flask_app/general/post_processing.py b/flask_app/general/post_processing.py index c4615fb..0af460f 100644 --- a/flask_app/general/post_processing.py +++ b/flask_app/general/post_processing.py @@ -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。 额外提取 '采购要求' 下的 '技术要求' 内容。 diff --git a/flask_app/货物标/货物标解析main.py b/flask_app/货物标/货物标解析main.py index 43994c8..23fd732 100644 --- a/flask_app/货物标/货物标解析main.py +++ b/flask_app/货物标/货物标解析main.py @@ -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: