Problem
#420 made word hints match Total: / sum= when $ is in the same field. The /2 review of that landing found leftover gaps:
- Capture layout vs extraction — hint-first alternatives capture only the number.
OCRLabelAnchoredExtraction still uses hintGroupIndex = numberGroupIndex - 1, so hintLength / layout hint substring are 0. Match exists; longer-hint disambiguation and line-proximity scoring do not see the hint.
- Tests lock
range(of:) only — Total: 90.22 is not asserted through extract / applyStructuredExtraction.
- Reverse arm still uses one
\\s+ for every hint (90.22: total, 90.22=sum miss).
- Glued
$90.22 — currency separator requires \\s+.
$/gal must stay a word hint (colon/equals), not the currency-symbol set.
Expected
- Hint-first alternatives are
(hint)(?:separator)(number) so adjacent capture groups are hint then number.
- Number-first uses the same per-hint separators.
- Currency symbols (
$€£¥) allow optional words and optional space ($90.22, $ This Sale 90.22).
OCRLabelAnchoredExtraction.extract returns totalCost=90.22 for Total: 90.22 when $ is in ocrHints.
hintLength for that match is total.count (5).
$/gal: 7.22 still matches as a word hint.
Related
#420, #382, #282
Problem
#420 made word hints match
Total:/sum=when$is in the same field. The /2 review of that landing found leftover gaps:OCRLabelAnchoredExtractionstill useshintGroupIndex = numberGroupIndex - 1, sohintLength/ layout hint substring are 0. Match exists; longer-hint disambiguation and line-proximity scoring do not see the hint.range(of:)only —Total: 90.22is not asserted throughextract/applyStructuredExtraction.\\s+for every hint (90.22: total,90.22=summiss).$90.22— currency separator requires\\s+.$/galmust stay a word hint (colon/equals), not the currency-symbol set.Expected
(hint)(?:separator)(number)so adjacent capture groups are hint then number.$€£¥) allow optional words and optional space ($90.22,$ This Sale 90.22).OCRLabelAnchoredExtraction.extractreturnstotalCost=90.22forTotal: 90.22when$is inocrHints.hintLengthfor that match istotal.count (5).$/gal: 7.22still matches as a word hint.Related
#420, #382, #282