Edited OCR for is_evolved
Browse files
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
|
|
@@ -183,6 +183,7 @@ class OCRService:
|
|
| 183 |
|
| 184 |
# Uses PSM 6 (block of text mode)
|
| 185 |
text = pytesseract.image_to_string(region, config="--psm 6 --oem 3")
|
|
|
|
| 186 |
|
| 187 |
# Primary: match "Weight: 76 lbs." with flexible spacing/punctuation
|
| 188 |
match = re.search(r"Weight[:\s]+([\d.]+\s*lbs?\.?)", text, re.IGNORECASE)
|
|
|
|
| 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
|
|
|
|
| 183 |
|
| 184 |
# Uses PSM 6 (block of text mode)
|
| 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)
|