Enum Recognizer
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§
§impl Recognizer
impl Recognizer
pub fn integer() -> Recognizer
pub fn integer() -> Recognizer
First integer, optionally anchored to nearby words.
pub fn integer_near<I, S>(anchors: I) -> Recognizer
pub fn integer_near<I, S>(anchors: I) -> Recognizer
Integer recognized only when one of anchors is present.
pub fn money() -> Recognizer
pub fn money() -> Recognizer
A monetary amount.
pub fn regex(pattern: &str) -> Recognizer
pub fn regex(pattern: &str) -> Recognizer
A regex (first capture group, or the whole match).
pub fn one_of<I, S>(options: I) -> Recognizer
pub fn one_of<I, S>(options: I) -> Recognizer
Match against a fixed set of options (case-insensitive substring).
pub fn fuzzy<I, S>(options: I) -> Recognizer
pub fn fuzzy<I, S>(options: I) -> Recognizer
Fuzzy-match against options with a default 0.85 threshold.
pub fn yes_no() -> Recognizer
pub fn yes_no() -> Recognizer
Affirmative/negative.
pub fn datetime() -> Recognizer
pub fn datetime() -> Recognizer
A calendar/clock expression normalized to a JSON object.
Trait Implementations§
§impl Clone for Recognizer
impl Clone for Recognizer
§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