Przeglądaj źródła

采购意向表格预算提取修复

znj 11 miesięcy temu
rodzic
commit
ccad56b6ed
1 zmienionych plików z 26 dodań i 15 usunięć
  1. 26 15
      BiddingKG/dl/interface/predictor.py

+ 26 - 15
BiddingKG/dl/interface/predictor.py

@@ -3156,10 +3156,12 @@ class ProductAttributesPredictor():
                             _budget = col1_l[i]
                             re_price = re.findall("[零壹贰叁肆伍陆柒捌玖拾佰仟萬億圆十百千万亿元角分]{3,}|\d[\d,]*(?:\.\d+)?万?", _budget)
                             if re_price:
-                                _budget = re_price[0]
-                                if '万元' in col0_l[i] and '万' not in _budget:
-                                    _budget += '万元'
-                                budget = str(getUnifyMoney(_budget))
+                                # _budget = re_price[0]
+                                # if '万元' in col0_l[i] and '万' not in _budget:
+                                #     _budget += '万元'
+                                # budget = str(getUnifyMoney(_budget))
+                                _budget, _money_unit = money_process(_budget, col0_l[i])
+                                budget = str(_budget)
                                 if '.' in budget:
                                     budget = budget.rstrip('0').rstrip('.')
                                 if float(budget)>= 500*100000000:
@@ -3702,13 +3704,17 @@ class ProductAttributesPredictor():
                                         _unitPrice = deal_list[id3]
                                         re_price = re.findall("[零壹贰叁肆伍陆柒捌玖拾佰仟萬億圆十百千万亿元角分]{3,}|\d[\d,]*(?:\.\d+)?万?",_unitPrice)
                                         if re_price:
-                                            _unitPrice = re_price[0]
-                                            if '万元' in header_list[3] and '万' not in _unitPrice:
-                                                _unitPrice += '万元'
-                                            unitPrice = getUnifyMoney(_unitPrice)
-                                            if unitPrice>=10000*10000:
-                                                unitPrice = ""
-                                            unitPrice = str(unitPrice)
+                                            # _unitPrice = re_price[0]
+                                            # if '万元' in header_list[3] and '万' not in _unitPrice:
+                                            #     _unitPrice += '万元'
+                                            # unitPrice = getUnifyMoney(_unitPrice)
+                                            # if unitPrice>=10000*10000:
+                                            #     unitPrice = ""
+                                            # unitPrice = str(unitPrice)
+                                            _unitPrice, _money_unit = money_process(_unitPrice, header_list[3])
+                                            if _unitPrice >= 10000 * 10000:
+                                                _unitPrice = ""
+                                            unitPrice = str(_unitPrice)
                                             if '.' in unitPrice:
                                                 unitPrice = unitPrice.rstrip('0').rstrip('.')
                                 if id4 != "":
@@ -3735,10 +3741,12 @@ class ProductAttributesPredictor():
                                         _budget = deal_list[id7]
                                         re_price = re.findall("[零壹贰叁肆伍陆柒捌玖拾佰仟萬億圆十百千万亿元角分]{3,}|\d[\d,]*(?:\.\d+)?万?",_budget)
                                         if re_price:
-                                            _budget = re_price[0]
-                                            if '万元' in header_list2[2] and '万' not in _budget:
-                                                _budget += '万元'
-                                            budget = str(getUnifyMoney(_budget))
+                                            # _budget = re_price[0]
+                                            # if '万元' in header_list2[2] and '万' not in _budget:
+                                            #     _budget += '万元'
+                                            # budget = str(getUnifyMoney(_budget))
+                                            _budget, _money_unit = money_process(_budget, header_list2[2])
+                                            budget = str(_budget)
                                             if '.' in budget:
                                                 budget = budget.rstrip('0').rstrip('.')
                                             if float(budget)>= 100000*10000:
@@ -3873,10 +3881,13 @@ class ProductAttributesPredictor():
 
 
     def add_product_attrs(self,channel_dic, product_attrs,  list_sentences,list_entitys,list_outlines,product_list,codeName,prem,text,page_time):
+        # print(1,product_attrs[1]['demand_info']['data'])
         if channel_dic['docchannel']['docchannel']=="采购意向" and len(product_attrs[1]['demand_info']['data']) == 0:
             product_attrs = self.predict_without_table(product_attrs, list_sentences,list_entitys,codeName,prem,text,page_time)
+        # print(2,product_attrs[1]['demand_info']['data'])
         if len(product_attrs[0]['product_attrs']['data']) == 0:
             product_attrs = self.predict_by_text(product_attrs,text,list_outlines,product_list,page_time)
+        # print(3,product_attrs[1]['demand_info']['data'])
         if len(product_attrs[1]['demand_info']['data'])>0:
             for d in product_attrs[1]['demand_info']['data']:
                 for product in set(prem[0]['product']):