OCR measurements were causing the LLM to over-rely on bounding box numbers
and fail correct assets on minor measurement inaccuracies. Changes:
- All prompts now say "supplementary data" not "authoritative/primary source"
- LLM instructed to prioritise visual assessment, use OCR to confirm/question
- Alignment tolerance widened from 1.5% to 3% of width
- OCR context footer softened with accuracy caveat (~5-10px margin of error)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tesseract was grouping date + logo text into one block (e.g. "8-11 luglio
amazon prime day"), inflating the date char_height and causing false
typography failures. Now groups by (block_num, line_num) so each text
line becomes a separate element, enabling correct identification of
date, logo, and legal as distinct elements.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Amazon guidelines define margins as 7% of shortest side, but OCR was only
reporting % of width — giving misleadingly small numbers on wide formats
(e.g. 2.6% of 1920px width = 50px, but 6.9% of 720px shortest side).
Now includes shortest-side percentage prominently in OCR context, plus the
7% target in pixels so the LLM can compare directly.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds Tesseract-based OCR pre-processing that computes pixel-level text
positions, margins, spacing, and alignment before LLM analysis. This
enables detection of subtle layout differences that vision models miss
(e.g. 2.8% vs 6.4% headline margin, 83px vs 39px date gap).
OCR measurements injected into 10 checks across all client profiles:
- Amazon: margins, typography, headline_layout
- Static General: element_alignment, safety_area, visual_hierarchy_general,
text_readability_general, text_edge_clearance
- L'Oreal: text_readability
- Diageo/Unilever KV: visual_hierarchy
Non-blocking: if Tesseract is unavailable, checks run with visual
estimation only. Production requires: sudo apt install tesseract-ocr
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>