浏览代码

中标联系方式遗漏修复

znj 1 年之前
父节点
当前提交
b523f5c305
共有 1 个文件被更改,包括 17 次插入1 次删除
  1. 17 1
      BiddingKG/dl/interface/getAttributes.py

+ 17 - 1
BiddingKG/dl/interface/getAttributes.py

@@ -2193,14 +2193,18 @@ def findAttributeAfterEntity(PackDict,roleSet,PackageList,PackageSet,list_senten
                                             value = (-1 / 2 * (distance ** 2))
                                             match_list2.append(Match(entity, previous_entity, value))
     # print(match_list2)
+    # print([(mat.main_role.entity_text,mat.attribute.entity_text if not isinstance(mat.attribute, tuple) else mat.attribute[1]) for mat in match_list2])
     match_list2 = [mat for mat in match_list2 if mat.main_role not in linked_company and mat.attribute not in linked_person]
     # print(match_list2)
+    # print([(mat.main_role.entity_text,mat.attribute.entity_text if not isinstance(mat.attribute, tuple) else mat.attribute[1]) for mat in match_list2])
+
     # km算法分配求解
     result2 = dispatch(match_list2)
     # print(result2)
     for match in result2:
         entity = match[0]
         # print(entity.entity_text)
+        # print(entity.label)
         # print(match.attribute)
         entity_index = list_entity.index(entity)
         is_update = False
@@ -2234,7 +2238,8 @@ def findAttributeAfterEntity(PackDict,roleSet,PackageList,PackageSet,list_senten
                                 is_update = True
                 else:
                     if PackDict[k]["roleList"][i].entity_text == entity.entity_text:
-                        if not PackDict[k]["roleList"][i].linklist:
+                        # if not PackDict[k]["roleList"][i].linklist:
+                        if len([item for item in PackDict[k]["roleList"][i].linklist if item[1]])==0: # 有联系人但无联系方式(号码)
                             if person_ not in tenderee_contact and len(set(phone_)&set(tenderee_phone))==0 and \
                                     person_ not in agency_contact and len(set(phone_)&set(agency_phone))==0:
                                 if not phone_:
@@ -2250,6 +2255,17 @@ def findAttributeAfterEntity(PackDict,roleSet,PackageList,PackageSet,list_senten
                 list_entity[entity_index].pointer_person = []
             list_entity[entity_index].pointer_person.append(match[1])
 
+    # print('tenderee_contact',tenderee_contact)
+    # print('tenderee_phone',tenderee_phone)
+    # print('agency_contact',agency_contact)
+    # print('agency_phone',agency_phone)
+    # print('PackDict')
+    # for k in PackDict.keys():
+    #     for i in range(len(PackDict[k]["roleList"])):
+    #         print(PackDict[k]["roleList"][i].role_name)
+    #         print(PackDict[k]["roleList"][i].entity_text)
+    #         print(PackDict[k]["roleList"][i].linklist)
+
     linked_person = []
     linked_persons_with = []
     for company_entity in [entity for entity in list_entity if entity.entity_type in ['company','org']]: