Эх сурвалжийг харах

修复报错及发现的角色金额预测问题

lsm 3 сар өмнө
parent
commit
9ee6411c19

+ 2 - 2
BiddingKG/dl/interface/Preprocessing.py

@@ -3750,7 +3750,7 @@ def get_preprocessed_entitys(list_sentences,useselffool=True,cost_time=dict()):
                 entity_text = ner_entity[3]
 
                 if entity_type in ["org", "company"] and re.search('^((特殊)?普通合伙)|^(有限合伙)', sentence_text[end_index_temp:]): # 规则补充合伙关键词
-                    partnership = re.search('^((特殊)?普通合伙)', sentence_text[end_index_temp:]).group(0)
+                    partnership = re.search('^((特殊)?普通合伙)|^(有限合伙)', sentence_text[end_index_temp:]).group(0)
                     end_index_temp += len(partnership)
                     entity_text += partnership
 
@@ -3838,7 +3838,7 @@ def get_preprocessed_entitys(list_sentences,useselffool=True,cost_time=dict()):
 
                     '''下面对公司实体进行清洗'''
                     entity_text = re.sub('\s', '', entity_text)
-                    if re.search('^(\d{4}年)?[\-\d月日份]*\w{2,3}分公司$|^\w{,6}某(部|医院)$', 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):  # 删除

+ 1 - 1
BiddingKG/dl/interface/extract.py

@@ -488,7 +488,7 @@ def predict(doc_id,text,title="",page_time="",web_source_no='',web_source_name="
 
     # data_res = Preprocessing.union_result(Preprocessing.union_result(codeName, prem),list_punish_dic)[0]
     # data_res = Preprocessing.union_result(Preprocessing.union_result(Preprocessing.union_result(codeName, prem),list_punish_dic), list_channel_dic)[0]
-    version_date = {'version_date': '2025-03-03'}
+    version_date = {'version_date': '2025-03-10'}
     data_res = dict(codeName[0], **prem[0], **channel_dic, **product_attrs[0], **product_attrs[1], **payment_way_dic, **fail_reason, **industry, **district, **candidate_dic, **version_date, **all_moneys, **pb_json)
 
     if original_docchannel == 302:

+ 5 - 0
BiddingKG/dl/interface/getAttributes.py

@@ -4856,6 +4856,11 @@ def confirm_prem(prem, channel_dic, is_deposit_project=False, total_tendereeMone
                 prem.pop(k)
     elif "Project" in prem:
         prem['Project']['uuid'] = str(uuid.uuid4())
+    if len(prem) == 2:
+        del_k = [k for k,v in prem.items() if v.get('roleList', [])==[] and v.get('tendereeMoney', 0)==0 and v.get('unit_tendereeMoney', 0)==0] # 20250310 删除掉没有角色且招标金额为0 的包
+        for k in del_k:
+            prem.pop(k)
+            # print('删除掉没有角色且招标金额为0 的包', k)
     if is_deposit_project and float(total_tendereeMoney)!=0 and len(prem)==1: #20241107 存款类项目有总投资没招标金额且只有一个标段,把总投资作招标金额
         for k in prem:
             if float(prem[k]['tendereeMoney'])==0:

+ 9 - 2
BiddingKG/dl/interface/predictor.py

@@ -925,7 +925,7 @@ class PREMPredict():
                     values[label] = 0.5
                 elif re.search('现由$', front) and re.search('^作为\d个单位的牵头(单位|公司)?', behind): # 修复 469369884 站源批量预测错误 现由第七合同段保利长大工程有限公司作为6个单位的牵头单位,
                     label = 5
-                elif re.search('(中标|成交)(人|公告|公示),$|中标人信息:$', front): # 20250227修复中标错误 588005167 现确定贵公司为该项目的中标人,中国二冶集团有限公司,2025年01月26日,
+                elif re.search('(中标|成交)?|结果)?)(人|公告|公示),$|中标人信息:$', front): # 20250227修复中标错误 588005167 现确定贵公司为该项目的中标人,中国二冶集团有限公司,2025年01月26日,
                     label = 5
             elif re.search('是否中标:是,供应商', front) and label == 5:
                 label = 2
@@ -1530,7 +1530,7 @@ class RoleRulePredictor():
 
         self.SET_NOT_TENDERER = set(["人民政府","人民法院","中华人民共和国","人民检察院","评标委员会","中国政府","中国海关","中华人民共和国政府"])
         
-        self.pattern_money_tenderee = re.compile("投?标?最高限价|采购计划金额|项目预算|招标金额|采购金额|项目金额|投资估算|采购(单位|人)委托价|招标限价|拦标价|预算金额|标底|总计|限额|资金来源,?[为:]+\w{2,4}资金|采购成本价|总费用约?为|(招标|采购)总?(规模|额度|资金)|资金来源")  # |建安费用 不作为招标金额
+        self.pattern_money_tenderee = re.compile("投?标?最高限价|采购计划金额|项目预算|招标金额|采购金额|项目金额|投资估算|采购(单位|人)委托价|招标限价|拦标价|预算金额|标底|总计|限额|资金来源,?[为:]+\w{2,4}资金|采购成本价|总费用约?为|(招标|采购)总?(规模|额度|资金)|资金来源|合同价暂定")  # |建安费用 不作为招标金额
         self.pattern_money_tenderer = re.compile("((合同|成交|中标|应付款|交易|投标|验收|订单)[)\)]?(综合)?(总?金额|结果|[单报总]?价))|标的基本情况|承包价|报酬(含税):|经评审的价格|报价不?含税")  # 单写 总价 不能作为中标金额,很多表格有单价、总价
         self.pattern_money_tenderer_whole = re.compile("(以金额.*中标)|中标供应商.*单价|以.*元(报价)?(中标|中选|成交)")
         self.pattern_money_other = re.compile("代理费|服务费")
@@ -1907,6 +1907,8 @@ class RoleRulePredictor():
                                     front_text = _span[0][re.search(self.pattern_money_tenderer, _span[0]).end():]
                                     if re.search('\d[万亿]?元|元)?:?\d', front_text):  # 当前金额与关键词中间有金额的过滤掉
                                         break
+                                    elif re.search('合同价暂定为?$', _span[0]): # 20250310 修复 598504921 合同价暂定 为招标金额
+                                        break
                                     if re.search(self.pattern_money_other, _span[0]) is not None:
                                         if re.search(self.pattern_money_tenderer, _span[0]).span()[1] > \
                                                 re.search(self.pattern_money_other, _span[0]).span()[1]:
@@ -3726,6 +3728,10 @@ class ProductAttributesPredictor():
             for link in product_link:  # 预防最后一列总价为所有产品总价,列补全后所有产品总价一样情况
                 if 'total_price' in link:
                     link['total_price'] = ""
+        if len(demand_link) > 2 and demand_link[0].get('budget', '') != '' and len(set([d.get('budget', '') for d in demand_link])) == 1: # 20250310 去掉多项目共用招标金额 例:598019007
+            for d in demand_link:
+                if 'budget' in d:
+                    d['budget'] = ""
         if len(unit_price_list)>0 and len(unit_price_list)==len(product_link) and len(set(unit_price_list))/len(unit_price_list)<=0.5:  # 2023/7/18 如果单价重复率高不算总产品价避免错误
             # print('如果单价重复率高不算总产品价避免错误')
             total_product_money = 0
@@ -5888,6 +5894,7 @@ class DistrictPredictor():
         text = re.sub('中山([东南西][部区环]|黄圃|南头|东凤|小榄|石岐|翠亨|南朗)', '中山市', text)
         text = re.sub('横州市', '横县', text)  # 例:547363890 修复广西南宁横州 不在地区表问题
         text = re.sub('广东中山', '广东中山市', text)
+        text = re.sub('朝阳柳城经济开发区', '朝阳市', text)
         ser = re.search('海南(昌江|白沙|乐东|陵水|保亭|琼中)(黎族)?', text)
         if ser and '黎族' not in ser.group(0):
             text = text.replace(ser.group(0), ser.group(0) + '黎族')