|
@@ -1081,19 +1081,19 @@ def findAttributeAfterEntity(PackDict,roleSet,PackageList,PackageSet,list_entity
|
|
|
else:
|
|
|
tenderer_nums += 1
|
|
|
#前向查找属性
|
|
|
- if not match_nums or not byNotTenderer_match_nums:
|
|
|
+ if ent_idx!=0 and (not match_nums or not byNotTenderer_match_nums):
|
|
|
previous_entity = temp_entity_list[ent_idx - 1]
|
|
|
if previous_entity.entity_type == link_attribute:
|
|
|
- if previous_entity.sentence_index == entity.sentence_index:
|
|
|
- distance = (tokens_num_dict[entity.sentence_index] + entity.begin_index) - (
|
|
|
- tokens_num_dict[
|
|
|
- previous_entity.sentence_index] + previous_entity.end_index)
|
|
|
- if distance < 20:
|
|
|
- # 前向 没有 /10000
|
|
|
- value = (-1 / 2 * (distance ** 2))
|
|
|
- temp_match_list.append(Match(entity, previous_entity, value))
|
|
|
+ # if previous_entity.sentence_index == entity.sentence_index:
|
|
|
+ distance = (tokens_num_dict[entity.sentence_index] + entity.begin_index) - (
|
|
|
+ tokens_num_dict[previous_entity.sentence_index] + previous_entity.end_index)
|
|
|
+ if distance < 40:
|
|
|
+ # 前向 没有 /10000
|
|
|
+ value = (-1 / 2 * (distance ** 2))
|
|
|
+ temp_match_list.append(Match(entity, previous_entity, value))
|
|
|
# km算法分配求解
|
|
|
dispatch_result = dispatch(temp_match_list)
|
|
|
+ dispatch_result = sorted(dispatch_result, key=lambda x: (x[0].sentence_index,x[0].begin_index))
|
|
|
# print(dispatch_result)
|
|
|
for match in dispatch_result:
|
|
|
_entity = match[0]
|
|
@@ -1107,8 +1107,10 @@ def findAttributeAfterEntity(PackDict,roleSet,PackageList,PackageSet,list_entity
|
|
|
else:
|
|
|
packageName_entity = packagePointer.entity_text
|
|
|
if _attribute.notes == '单价' or float(_attribute.entity_text) < 5000: # 2021/12/17 调整小金额阈值,避免203608823.html 两次金额一次万元没提取到的情况
|
|
|
+ print(packageName_entity,_attribute.entity_text, _attribute.values[_attribute.label])
|
|
|
addMoneyByEntity(PackDict, packageName_entity, _entity.entity_text, _attribute,0.5)
|
|
|
else:
|
|
|
+ print(packageName_entity,_attribute.entity_text, _attribute.values[_attribute.label])
|
|
|
addMoneyByEntity(PackDict, packageName_entity, _entity.entity_text, _attribute,
|
|
|
_attribute.values[_attribute.label])
|
|
|
elif link_attribute=='serviceTime':
|
|
@@ -2232,7 +2234,6 @@ def findAttributeAfterEntity(PackDict,roleSet,PackageList,PackageSet,list_entity
|
|
|
for k,v in dict_pack_tenderer_money.items():
|
|
|
v[0].money = list(v[1])[0]
|
|
|
# print('k,v in dict_pack_tenderer_money.items', k, v)
|
|
|
-
|
|
|
# 2021/7/16 #增加判断中标金额是否远大于招标金额逻辑
|
|
|
for pack in PackDict.keys():
|
|
|
for i in range(len(PackDict[pack]["roleList"])):
|
|
@@ -2257,7 +2258,6 @@ def findAttributeAfterEntity(PackDict,roleSet,PackageList,PackageSet,list_entity
|
|
|
|
|
|
for item in list_pop:
|
|
|
PackDict.pop(item)
|
|
|
-
|
|
|
# 公告中只有"招标人"且无"联系人"链接时,直接取文中倒数第一个联系人
|
|
|
if len(PackDict)==1:
|
|
|
k = list(PackDict.keys())[0]
|