dcorcoran commited on
Commit
95ffe26
·
1 Parent(s): f6cf1f4

Updated regex

Browse files
Files changed (1) hide show
  1. app/services/ocr_service.py +3 -3
app/services/ocr_service.py CHANGED
@@ -52,7 +52,7 @@ class OCRService:
52
  text = pytesseract.image_to_string(top_left, config="--psm 6 --oem 3")
53
  print("IS_EVOLVED OCR RAW:", repr(text))
54
 
55
- if re.search(r'stage[\s.\-_]*[12]', text, re.IGNORECASE):
56
  return True
57
 
58
  # Fallback: check for "Evolves from" text which only appears on evolved cards
@@ -185,8 +185,8 @@ class OCRService:
185
  text = pytesseract.image_to_string(region, config="--psm 6 --oem 3")
186
  print("WEIGHT OCR RAW:", repr(text))
187
 
188
- # Primary: match "Weight: 76 lbs." with flexible spacing/punctuation
189
- match = re.search(r"Weight[:\s]+([\d.]+\s*lbs?\.?)", text, re.IGNORECASE)
190
  if match:
191
  return match.group(1).strip()
192
 
 
52
  text = pytesseract.image_to_string(top_left, config="--psm 6 --oem 3")
53
  print("IS_EVOLVED OCR RAW:", repr(text))
54
 
55
+ if re.search(r'stage[\s.\-_]*[12|I]', text, re.IGNORECASE):
56
  return True
57
 
58
  # Fallback: check for "Evolves from" text which only appears on evolved cards
 
185
  text = pytesseract.image_to_string(region, config="--psm 6 --oem 3")
186
  print("WEIGHT OCR RAW:", repr(text))
187
 
188
+ # Primary: match "Weight: 76." with flexible spacing/punctuation
189
+ match = re.search(r"Weight[:\s]+([\d.]+)", text, re.IGNORECASE)
190
  if match:
191
  return match.group(1).strip()
192