Solution · bots and AI features
Dates without hallucinations: rules handle dates, AI handles meaning
Language models confidently mix up dates: “Friday afternoon”, “a week from now at the same time”. When we handed everything to the model, it matched the reference on only 42 of 65 phrases. The solution is a hybrid: a deterministic rules-based parser handles dates in three languages, and the model handles only meaning and wording.
What it looks like
Mock-ups with demo data, no real data
🗓️Phrase → parse
| Phrase | Date (rules) | Meaning (AI) |
|---|---|---|
| “call on Friday afternoon” | Fri, 14:00 | Event |
| “a week from now, same time” | +7 d, same time | Task |
| “meeting tomorrow 2 to 3” | tomorrow 14:00–15:00 | Event |
| “move it an hour later” | — | Reschedule +1 h |
At a glance
- In production
- In the hey, nooka bot; the same approach in its iOS version (in development)
- Fits
- Any bot or assistant that creates tasks and events from everyday speech
- Needs
- Nothing special: the parser runs as a separate service
Result at the client
42 of 65
phrases the model got right on its own — 64.6%, which is why dates went to rules
128
date patterns in Russian, English and Spanish
65
phrases in the reference corpus — 100% pass required to ship
Match with the 65-phrase reference corpus
Before
- The model confuses weekdays, “next Friday” and “this Friday”, and years around New Year.
- A wrong date goes unnoticed until the task pops up on the wrong day.
- Prompting does not fix it: the model is probabilistic, but a date must be exact.
What was built
Rules-based parser
A separate service parses dates, ranges and times in three languages, accounting for the user’s time zone, seasons and year changes.
Clear division of labour
If the parser finds a date, it is used and the model’s dates are ignored. The model handles message type, title and reschedule target.
Reference corpus
65 real phrases with expected results run before every change. Until it is 100%, the change does not ship.
Stack
- Node.js
- chrono-node
- Regular expressions
- Swift (iOS port)
- AI models via API
Where it runs
Questions
Why not just improve the prompt?
We tried: a model that handled everything matched the reference on 64.6% of phrases. Dates need determinism — the same input must always give the same result.
What if a phrase matches no rule?
Then the model’s date is used, but that is rare: most real phrases are covered by the rules.