|
@@ -714,7 +714,9 @@ def tableToText(soup, docid=None, return_kv=False):
|
|
for i in range(len(inner_table)):
|
|
for i in range(len(inner_table)):
|
|
for j in range(len(inner_table[i])):
|
|
for j in range(len(inner_table[i])):
|
|
inner_table[i][j] = [origin_inner_table[i][j][0], int(predict_list[i][j])]
|
|
inner_table[i][j] = [origin_inner_table[i][j][0], int(predict_list[i][j])]
|
|
- if origin_inner_table[i][j][0] in ['主要环境影响及预防或者减轻不良环境影响的对策和措施', '建设单位或地方政府作出的相关环保承诺', '公众反馈意见的联系方式'] and predict_list[i][j]!=1:
|
|
|
|
|
|
+ if origin_inner_table[i][j][0] in ['主要环境影响及预防或者减轻不良环境影响的对策和措施', '建设单位或地方政府作出的相关环保承诺',
|
|
|
|
+ '公众反馈意见的联系方式', '区县', '项目领域', '成本/收入', '覆盖倍数', '会计所', '律所','建设期',
|
|
|
|
+ "发行时间" ,"批次" ,"发行额" ,"发行利率" ,"所属债券" ,"专项债作资本金发行额" ,"调整记录"] and predict_list[i][j]!=1:
|
|
inner_table[i][j] = [origin_inner_table[i][j][0], 1]
|
|
inner_table[i][j] = [origin_inner_table[i][j][0], 1]
|
|
elif origin_inner_table[i][j][0] in ['经评审的最低评标价法'] and predict_list[i][j]==1:
|
|
elif origin_inner_table[i][j][0] in ['经评审的最低评标价法'] and predict_list[i][j]==1:
|
|
inner_table[i][j] = [origin_inner_table[i][j][0], 0]
|
|
inner_table[i][j] = [origin_inner_table[i][j][0], 0]
|
|
@@ -3386,6 +3388,7 @@ def get_preprocessed_article(articles,cost_time = dict(),useselffool=True):
|
|
article_processed = re.sub('资,金', '资金', article_processed)
|
|
article_processed = re.sub('资,金', '资金', article_processed)
|
|
article_processed = re.sub('金,额', '金额', article_processed)
|
|
article_processed = re.sub('金,额', '金额', article_processed)
|
|
article_processed = re.sub('存,款', '存款', article_processed)
|
|
article_processed = re.sub('存,款', '存款', article_processed)
|
|
|
|
+ article_processed = re.sub('(适用于采用评定分离评标的项目)|(根据需要可以填写总价、单价、下浮率、费率等)|业绩(响应招标文件的业绩,多项应分别列出)', '', article_processed) # 修复关键词过远导致召回失败 例:579672495
|
|
if web_source_no.startswith('DX002756-'):
|
|
if web_source_no.startswith('DX002756-'):
|
|
article_processed = re.sub('状态:(进行中|已结束)单位', ',项目单位', article_processed) # 376225646
|
|
article_processed = re.sub('状态:(进行中|已结束)单位', ',项目单位', article_processed) # 376225646
|
|
if web_source_no.startswith('DX006116-') and re.search('结果公告如下:.{5,50},单位名称:', article_processed): # 2023/11/20 特殊处理 381591924 381592533 这种提取不到情况
|
|
if web_source_no.startswith('DX006116-') and re.search('结果公告如下:.{5,50},单位名称:', article_processed): # 2023/11/20 特殊处理 381591924 381592533 这种提取不到情况
|
|
@@ -3702,38 +3705,39 @@ def get_preprocessed_entitys(list_sentences,useselffool=True,cost_time=dict()):
|
|
|
|
|
|
ner_entitys = ner_entitys_all[sentence_index]
|
|
ner_entitys = ner_entitys_all[sentence_index]
|
|
|
|
|
|
- '''正则识别角色实体 经营部|经销部|电脑部|服务部|复印部|印刷部|彩印部|装饰部|修理部|汽修部|修理店|零售店|设计店|服务店|家具店|专卖店|分店|文具行|商行|印刷厂|修理厂|维修中心|修配中心|养护中心|服务中心|会馆|文化馆|超市|门市|商场|家具城|印刷社|经销处'''
|
|
|
|
- for it in re.finditer(
|
|
|
|
- '(?P<text_key_word>(((单一来源|中标|中选|中价|成交)(供应商|供货商|服务商|候选人|单位|人))|(供应商|供货商|服务商|候选人))(名称)?[为::]+)(?P<text>([()\w]{5,20})(厂|中心|超市|门市|商场|工作室|文印室|城|部|店|站|馆|行|社|处))[,。]',
|
|
|
|
- sentence_text):
|
|
|
|
- for k, v in it.groupdict().items():
|
|
|
|
- if k == 'text_key_word':
|
|
|
|
- keyword = v
|
|
|
|
- if k == 'text':
|
|
|
|
- entity = v
|
|
|
|
- b = it.start() + len(keyword)
|
|
|
|
- e = it.end() - 1
|
|
|
|
- if (b, e, 'location', entity) in ner_entitys:
|
|
|
|
- ner_entitys.remove((b, e, 'location', entity))
|
|
|
|
- ner_entitys.append((b, e, 'company', entity))
|
|
|
|
- elif (b, e, 'org', entity) not in ner_entitys and (b, e, 'company', entity) not in ner_entitys:
|
|
|
|
- ner_entitys.append((b, e, 'company', entity))
|
|
|
|
-
|
|
|
|
- for it in re.finditer(
|
|
|
|
- '(?P<text_key_word>((建设|招租|招标|采购)(单位|人)|业主)(名称)?[为::]+)(?P<text>\w{2,4}[省市县区镇]([()\w]{2,20})(管理处|办公室|委员会|村委会|纪念馆|监狱|管教所|修养所|社区|农场|林场|羊场|猪场|石场|村|幼儿园|海关|殡仪馆)|海门\w{2,15}村)[,。]',
|
|
|
|
- sentence_text):
|
|
|
|
- for k, v in it.groupdict().items():
|
|
|
|
- if k == 'text_key_word':
|
|
|
|
- keyword = v
|
|
|
|
- if k == 'text':
|
|
|
|
- entity = v
|
|
|
|
- b = it.start() + len(keyword)
|
|
|
|
- e = it.end() - 1
|
|
|
|
- if (b, e, 'location', entity) in ner_entitys:
|
|
|
|
- ner_entitys.remove((b, e, 'location', entity))
|
|
|
|
- ner_entitys.append((b, e, 'org', entity))
|
|
|
|
- if (b, e, 'org', entity) not in ner_entitys and (b, e, 'company', entity) not in ner_entitys:
|
|
|
|
- ner_entitys.append((b, e, 'org', entity))
|
|
|
|
|
|
+ # 20250320 注释掉下面代码 避免带来异常实体
|
|
|
|
+ # '''正则识别角色实体 经营部|经销部|电脑部|服务部|复印部|印刷部|彩印部|装饰部|修理部|汽修部|修理店|零售店|设计店|服务店|家具店|专卖店|分店|文具行|商行|印刷厂|修理厂|维修中心|修配中心|养护中心|服务中心|会馆|文化馆|超市|门市|商场|家具城|印刷社|经销处'''
|
|
|
|
+ # for it in re.finditer(
|
|
|
|
+ # '(?P<text_key_word>(((单一来源|中标|中选|中价|成交)(供应商|供货商|服务商|候选人|单位|人))|(供应商|供货商|服务商|候选人))(名称)?[为::]+)(?P<text>([()\u4e00-\u9fa5]{5,20})(厂|中心|超市|门市|商场|工作室|文印室|城|部|店|站|馆|行|社|处))[,。]',
|
|
|
|
+ # sentence_text):
|
|
|
|
+ # for k, v in it.groupdict().items():
|
|
|
|
+ # if k == 'text_key_word':
|
|
|
|
+ # keyword = v
|
|
|
|
+ # if k == 'text':
|
|
|
|
+ # entity = v
|
|
|
|
+ # b = it.start() + len(keyword)
|
|
|
|
+ # e = it.end() - 1
|
|
|
|
+ # if (b, e, 'location', entity) in ner_entitys:
|
|
|
|
+ # ner_entitys.remove((b, e, 'location', entity))
|
|
|
|
+ # ner_entitys.append((b, e, 'company', entity))
|
|
|
|
+ # elif (b, e, 'org', entity) not in ner_entitys and (b, e, 'company', entity) not in ner_entitys:
|
|
|
|
+ # ner_entitys.append((b, e, 'company', entity))
|
|
|
|
+ #
|
|
|
|
+ # for it in re.finditer(
|
|
|
|
+ # '(?P<text_key_word>((建设|招租|招标|采购)(单位|人)|业主)(名称)?[为::]+)(?P<text>[\u4e00-\u9fa5]{2,4}[省市县区镇]([()\u4e00-\u9fa5]{2,20})(管理处|办公室|委员会|村委会|纪念馆|监狱|管教所|修养所|社区|农场|林场|羊场|猪场|石场|村|幼儿园|海关|殡仪馆)|海门\w{2,15}村)[,。]',
|
|
|
|
+ # sentence_text):
|
|
|
|
+ # for k, v in it.groupdict().items():
|
|
|
|
+ # if k == 'text_key_word':
|
|
|
|
+ # keyword = v
|
|
|
|
+ # if k == 'text':
|
|
|
|
+ # entity = v
|
|
|
|
+ # b = it.start() + len(keyword)
|
|
|
|
+ # e = it.end() - 1
|
|
|
|
+ # if (b, e, 'location', entity) in ner_entitys:
|
|
|
|
+ # ner_entitys.remove((b, e, 'location', entity))
|
|
|
|
+ # ner_entitys.append((b, e, 'org', entity))
|
|
|
|
+ # if (b, e, 'org', entity) not in ner_entitys and (b, e, 'company', entity) not in ner_entitys:
|
|
|
|
+ # ner_entitys.append((b, e, 'org', entity))
|
|
|
|
|
|
for ner_entity in ner_entitys:
|
|
for ner_entity in ner_entitys:
|
|
if ner_entity[2] in ['company','org']:
|
|
if ner_entity[2] in ['company','org']:
|
|
@@ -3837,26 +3841,8 @@ def get_preprocessed_entitys(list_sentences,useselffool=True,cost_time=dict()):
|
|
entity_text = entity_text.replace("有公司","有限公司")
|
|
entity_text = entity_text.replace("有公司","有限公司")
|
|
|
|
|
|
'''下面对公司实体进行清洗'''
|
|
'''下面对公司实体进行清洗'''
|
|
- entity_text = re.sub('\s', '', entity_text)
|
|
|
|
- if re.search('^(\d{4}年)?[\-\d月日份]*\w{2,3}分公司$|^\w{,6}某(部|医院)$|空间布局$', entity_text): # 删除
|
|
|
|
- # print('公司实体不符合规范:', entity_text)
|
|
|
|
- continue
|
|
|
|
- elif re.match('xx|XX', entity_text): # 删除
|
|
|
|
- # print('公司实体不符合规范:', entity_text)
|
|
|
|
- continue
|
|
|
|
- elif re.match('\.?(rar|zip|pdf|df|doc|docx|xls|xlsx|jpg|png)', entity_text):
|
|
|
|
- entity_text = re.sub('\.?(rar|zip|pdf|df|doc|docx|xls|xlsx|jpg|png)', '', entity_text)
|
|
|
|
- elif re.match(
|
|
|
|
- '((\d{4}[年-])[\-\d:\s元月日份]*|\d{1,2}月[\d日.-]*(日?常?计划)?|\d{1,2}[.-]?|[A-Za-z](包|标段?)?|[a-zA-Z0-9]+-[a-zA-Z0-9-]*|[a-zA-Z]{1,2}|[①②③④⑤⑥⑦⑧⑨⑩]|\s|title\=|【[a-zA-Z0-9]+】|[^\w])[\u4e00-\u9fa5]+',
|
|
|
|
- entity_text):
|
|
|
|
- filter = re.match(
|
|
|
|
- '((\d{4}[年-])[\-\d:\s元月日份]*|\d{1,2}月[\d日.-]*(日?常?计划)?|\d{1,2}[.-]?|[A-Za-z](包|标段?)?|[a-zA-Z0-9]+-[a-zA-Z0-9-]*|[a-zA-Z]{1,2}|[①②③④⑤⑥⑦⑧⑨⑩]|\s|title\=|【[a-zA-Z0-9]+】|[^\w])[\u4e00-\u9fa5]+',
|
|
|
|
- entity_text).group(1)
|
|
|
|
- entity_text = entity_text.replace(filter, '')
|
|
|
|
- elif re.search('\]|\[|\]|[【】{}「?:∶〔·.\'#~_ΓΙεⅠ]', entity_text):
|
|
|
|
- entity_text = re.sub('\]|\[|\]|[【】「?:∶〔·.\'#~_ΓΙεⅠ]', '', entity_text)
|
|
|
|
- if len(re.sub('(项目|分|有限)?公司|集团|制造部|中心|医院|学校|大学|中学|小学|幼儿园', '', entity_text))<2:
|
|
|
|
- # print('公司实体不符合规范:', entity_text)
|
|
|
|
|
|
+ entity_text = clean_company(entity_text)
|
|
|
|
+ if entity_text == '':
|
|
continue
|
|
continue
|
|
|
|
|
|
entity_text = cut_repeat_name(entity_text) # 20231201 重复名称去重 如:中山大学附属第一医院中山大学附属第一医院中山大学附属第一医院
|
|
entity_text = cut_repeat_name(entity_text) # 20231201 重复名称去重 如:中山大学附属第一医院中山大学附属第一医院中山大学附属第一医院
|