Namra-Satva commited on
Commit
b4eb289
·
verified ·
1 Parent(s): 6f8fe5a

Update model_utils.py

Browse files
Files changed (1) hide show
  1. model_utils.py +3 -3
model_utils.py CHANGED
@@ -37,10 +37,10 @@ def parse_products(raw_text):
37
  match_description_mixed=re.search(r"^(.*?)(\d+)\s+[^A-Za-z0-9\s]?([\d.,]+)\s+[^A-Za-z0-9\s]?([\d.,]+)$", desc.strip())
38
  elif match_description_mixed:
39
  structured.append({
40
- "qty":int(match.group(2)),
41
  "description": match_description_mixed.group(1).strip(" .:-"),
42
- "unit_price": float(match.group(3).replace(",", "")),
43
- "amount": float(match.group(4).replace(",", ""))
44
  })
45
  elif line.strip():
46
  structured.append({
 
37
  match_description_mixed=re.search(r"^(.*?)(\d+)\s+[^A-Za-z0-9\s]?([\d.,]+)\s+[^A-Za-z0-9\s]?([\d.,]+)$", desc.strip())
38
  elif match_description_mixed:
39
  structured.append({
40
+ "qty":int(match_description_mixed.group(2)),
41
  "description": match_description_mixed.group(1).strip(" .:-"),
42
+ "unit_price": float(match_description_mixed.group(3).replace(",", "")),
43
+ "amount": float(match_description_mixed.group(4).replace(",", ""))
44
  })
45
  elif line.strip():
46
  structured.append({