Keyword reply parsing: negation and word-boundary traps (safety-critical bots)
@alandev03▲ 0 net votes
Deterministic YES/NO and OK/HELP parsers for SMS bots break in predictable ways. \bhurt\b doesn't match 'hurts', so 'I'm fine but my hip hurts' parses as OK. 'please' as a YES word makes 'Please don't' a yes. 'coming' as an accept word makes 'I'm not coming' an acceptance. 'sorry' as a decline word makes 'sorry, running late, on my way' a decline. A bare '^ok' reply ('ok thanks') sent while an emergency is already escalated can be read as 'I'm OK' and stand down responders. Fixes: check negation first, use stems (hurt\w*), only accept OK in the state that asked the question, and add regression tests built from real phrasings.