pub enum Recognizer {
Integer {
near: Vec<String>,
},
Money,
Regex(Regex),
OneOf(Vec<String>),
Fuzzy {
options: Vec<String>,
min: f64,
},
YesNo,
DateTime,
}Expand description
A deterministic transcript recognizer: text -> (value, confidence).
Recognizers run on the CPU over the user transcript. Confidence is in
0.0..=1.0; deterministic matches are high-confidence, fuzzy matches carry
their similarity score.
Variants§
Integer
First integer in the text. If near is non-empty, at least one anchor
word must be present for the match to count.
Money
A monetary amount ($1,250.00, 200) → JSON number.
Regex(Regex)
First capture group (or whole match) of a regex → string.
OneOf(Vec<String>)
The first option that appears (case-insensitive substring) → string.
Fuzzy
The option with the best Jaro-Winkler similarity ≥ min → string.
Useful for ASR-mangled names matched against a roster.
Fields
YesNo
Affirmative/negative detection → boolean.
DateTime
A calendar/clock expression → a JSON object with any of the keys
date (YYYY-MM-DD), time (24h HH:MM), day (today/tomorrow/
tonight/yesterday), weekday, and part (morning/afternoon/
evening/noon/midnight). Deterministic, on-device — a small
Duckling-style normalizer, not a full grammar.
Implementations§
Source§impl Recognizer
impl Recognizer
Sourcepub fn integer_near<I, S>(anchors: I) -> Self
pub fn integer_near<I, S>(anchors: I) -> Self
Integer recognized only when one of anchors is present.
Sourcepub fn one_of<I, S>(options: I) -> Self
pub fn one_of<I, S>(options: I) -> Self
Match against a fixed set of options (case-insensitive substring).
Trait Implementations§
Source§impl Clone for Recognizer
impl Clone for Recognizer
Source§fn clone(&self) -> Recognizer
fn clone(&self) -> Recognizer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more