|
@@ -3436,8 +3436,7 @@ class ProductAttributesPredictor():
|
|
|
parameter = ""
|
|
|
if quantity != "" or unitPrice != "" or brand != "" or specs != "" or total_price:
|
|
|
if id2 != "" and id3 != "" and len(re.split('[;;、,\n]', deal_list[id2])) > 1 and len(
|
|
|
- re.split('[;;、,\n]', deal_list[id1])) == len(re.split('[;;、,\n]', deal_list[
|
|
|
- id2])): # 处理一个空格包含多个产品,逗号或空格分割情况 例子 292846806 292650743
|
|
|
+ re.split('[;;、,\n]', deal_list[id1])) == len(re.split('[;;、,\n]', deal_list[id2])): # 处理一个空格包含多个产品,逗号或空格分割情况 例子 292846806 292650743
|
|
|
products = re.split('[;;、,\n]', deal_list[id1])
|
|
|
quantitys = re.split('[;;、,\n]', deal_list[id2])
|
|
|
unitPrices = re.split('[;;、,\n]', deal_list[id3])
|
|
@@ -3455,10 +3454,9 @@ class ProductAttributesPredictor():
|
|
|
for product, quantity, unitPrice, brand, specs, total_price, parameter in zip(
|
|
|
products, quantitys, unitPrices, brands, specses, total_prices,
|
|
|
parameters):
|
|
|
- # if quantity != "":
|
|
|
- # quantity, quantity_unit_ = self.fix_quantity(quantity,
|
|
|
- # header_quan_unit)
|
|
|
- # quantity_unit = quantity_unit_ if quantity_unit_ != "" else quantity_unit
|
|
|
+ if quantity != "":
|
|
|
+ quantity, quantity_unit_ = self.fix_quantity(quantity,quantity_unit)
|
|
|
+ quantity_unit = quantity_unit_ if quantity_unit_ != "" else quantity_unit
|
|
|
if unitPrice != "":
|
|
|
unitPrice, _money_unit = money_process(unitPrice, header_list[3])
|
|
|
unitPrice = str(unitPrice) if unitPrice != 0 else ""
|
|
@@ -3490,9 +3488,9 @@ class ProductAttributesPredictor():
|
|
|
# i += 1
|
|
|
continue
|
|
|
else:
|
|
|
- # if quantity != "":
|
|
|
- # quantity, quantity_unit_ = self.fix_quantity(quantity, header_quan_unit)
|
|
|
- # quantity_unit = quantity_unit_ if quantity_unit_ != "" else quantity_unit
|
|
|
+ if quantity != "":
|
|
|
+ quantity, quantity_unit_ = self.fix_quantity(quantity, quantity_unit)
|
|
|
+ quantity_unit = quantity_unit_ if quantity_unit_ != "" else quantity_unit
|
|
|
if unitPrice != "":
|
|
|
unitPrice, _money_unit = money_process(unitPrice, header_list[3])
|
|
|
unitPrice = str(unitPrice) if unitPrice != 0 else ""
|