Enum SlotRecognizer
pub enum SlotRecognizer {
Integer,
IntegerNear(Vec<String>),
Money,
Regex(String),
OneOf(Vec<String>),
Fuzzy(Vec<String>),
YesNo,
DateTime,
}Expand description
A serializable description of the deterministic recognizer that fills a slot.
Mirrors Recognizer but is serde-friendly (it holds patterns/options as
data, not a compiled Regex), so a FrameSpec — and the conversation spec
that embeds it — round-trips through JSON/YAML. Lower to a runtime recognizer
with SlotRecognizer::to_recognizer.
Variants§
Integer
First integer in the text.
IntegerNear(Vec<String>)
First integer, but only when one of these anchor words is present.
Money
A monetary amount.
Regex(String)
First capture (or whole match) of this regex pattern.
OneOf(Vec<String>)
The first of these options to appear (case-insensitive substring).
Fuzzy(Vec<String>)
The best Jaro-Winkler match among these options.
YesNo
Affirmative/negative → boolean.
DateTime
A calendar/clock expression → a JSON object.
Implementations§
§impl SlotRecognizer
impl SlotRecognizer
pub fn to_recognizer(&self) -> Recognizer
pub fn to_recognizer(&self) -> Recognizer
Lower to a runtime Recognizer.
Trait Implementations§
§impl Clone for SlotRecognizer
impl Clone for SlotRecognizer
§fn clone(&self) -> SlotRecognizer
fn clone(&self) -> SlotRecognizer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for SlotRecognizer
impl Debug for SlotRecognizer
§impl<'de> Deserialize<'de> for SlotRecognizer
impl<'de> Deserialize<'de> for SlotRecognizer
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SlotRecognizer, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SlotRecognizer, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl PartialEq for SlotRecognizer
impl PartialEq for SlotRecognizer
§impl Serialize for SlotRecognizer
impl Serialize for SlotRecognizer
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for SlotRecognizer
Auto Trait Implementations§
impl Freeze for SlotRecognizer
impl RefUnwindSafe for SlotRecognizer
impl Send for SlotRecognizer
impl Sync for SlotRecognizer
impl Unpin for SlotRecognizer
impl UnwindSafe for SlotRecognizer
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
Mutably borrows from an owned value. Read more