SIGN IN SIGN UP

fix(grounding): stop rejecting thousands-separated numbers (#123)

* fix(grounding): clear separator-formatted numbers the engine flags as ungrounded

The engine parses a thousands-separated number correctly but its literal
substring grounding check reports the emitted value as fabricated, because
"1200.0" is not a substring of "$1,200.00". The Python package propagated
that verdict: extract() raised on a correct value and run() refused a
correct call, including the README's own extraction example.

A flagged numeric path is now cleared when the emitted value matches a
whole number token in the source under numeric comparison rather than
substring comparison. Only engine flags are removed, so the check cannot
reject a value the engine itself accepted.

Fixes #120

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Signed-off-by: Som Samantray <som.samantray@gmail.com>

* fix(review): apply review findings

Anchoring the optional sign in the number-token pattern stops a hyphen
between digits from being read as a minus sign. Without it, a source
containing an ISO date such as 2026-09-01 yielded -9 and -1 tokens, so a
fabricated negative argument whose magnitude matched the date was treated
as grounded and the engine's ungrounded flag was cleared.

Adds regression coverage for the date and range hyphen cases, and for a
genuinely written negative still clearing.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Signed-off-by: Som Samantray <som.samantray@gmail.com>

---------

Signed-off-by: Som Samantray <som.samantray@gmail.com>
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
S
Som Samantray committed
956840ff176bfe179bb2f230b726f4be44fb11cf
Parent: 9bbc9d7
Committed by GitHub <noreply@github.com> on 9/12/2026, 7:49:41 PM