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() -> Recognizer
pub fn integer() -> Recognizer
First integer, optionally anchored to nearby words.
Sourcepub 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.
Sourcepub fn money() -> Recognizer
pub fn money() -> Recognizer
A monetary amount.
Sourcepub fn regex(pattern: &str) -> Recognizer
pub fn regex(pattern: &str) -> Recognizer
A regex (first capture group, or the whole match).
Sourcepub 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).
Sourcepub 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.
Sourcepub fn yes_no() -> Recognizer
pub fn yes_no() -> Recognizer
Affirmative/negative.
Sourcepub fn datetime() -> Recognizer
pub fn datetime() -> Recognizer
A calendar/clock expression normalized to a JSON object.
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 moreAuto Trait Implementations§
impl Freeze for Recognizer
impl RefUnwindSafe for Recognizer
impl Send for Recognizer
impl Sync for Recognizer
impl Unpin for Recognizer
impl UnwindSafe for Recognizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].