Skip to main content

Module units

Module units 

Source
Expand description

Units + numeric parsing — turns raw cell values and tagged quantity spans into comparable numbers so IKL’s (num <field> <op> <value>) range predicate can filter on magnitude (e.g. “braking distance ≤ 70 m”, “range ≥ 800”, “price < 30000”). Two entry points: • parse_number — a bare numeric (CSV cell): strips thousands separators, currency, %. • parse_quantity — a value+unit span (from the QTY tagger): canonicalises to an SI dimension so “100 km/h” and “27.8 m/s” compare, tagged under a dimensional field (qty-length, qty-mass…).

Functions§

cmp_op
Evaluate a numeric comparison for a stored value: value op target.
parse_number
Parse a bare number from a cell, tolerating thousands separators, a leading currency symbol, and a trailing percent sign. None if it isn’t numeric.
parse_quantity
Parse a <number><unit> quantity → (dimensional field, SI value). Recognises the common engineering dimensions; returns None for anything it can’t canonicalise.