Skip to main content

Module patterns

Module patterns 

Source
Expand description

Text parsers for OCR output. Used with WatcherBuilder::ocr.

Functions§

number
Parse the first numeric token out of recognized text ("HP 1,234/5,000" -> 1234.0). Scans for the first run of ASCII digits, treating embedded commas as ignorable OCR noise (any count or position) and one embedded . as a decimal point; a leading . is not part of the number (".5" -> 5.0). Malformed sequences (e.g. multi-dot tokens like “1.2.3”) fail to parse and are skipped rather than aborting the scan, so a later well-formed token can still match. Returns None when nothing in the whole text parses to a finite value; never returns NaN/inf.