pub struct VoiceCommandRegistry { /* private fields */ }Expand description
Registry of voice command shortcuts.
Supports exact prefix matching and Levenshtein fuzzy matching (edit distance <= 2) on the trigger phrase portion of transcriptions.
Implementations§
Source§impl VoiceCommandRegistry
impl VoiceCommandRegistry
Sourcepub fn new(commands: Vec<VoiceCommand>) -> Self
pub fn new(commands: Vec<VoiceCommand>) -> Self
Build a registry from a list of voice commands.
Sourcepub fn match_command(&self, transcription: &str) -> Option<&VoiceCommand>
pub fn match_command(&self, transcription: &str) -> Option<&VoiceCommand>
Match a transcribed phrase against registered commands.
Returns the matched command if the transcription starts with or closely matches a registered trigger phrase (Levenshtein distance <= 2).
Sourcepub fn list(&self) -> &[VoiceCommand]
pub fn list(&self) -> &[VoiceCommand]
List all registered commands.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Build a registry with the default built-in commands.
Auto Trait Implementations§
impl Freeze for VoiceCommandRegistry
impl RefUnwindSafe for VoiceCommandRegistry
impl Send for VoiceCommandRegistry
impl Sync for VoiceCommandRegistry
impl Unpin for VoiceCommandRegistry
impl UnsafeUnpin for VoiceCommandRegistry
impl UnwindSafe for VoiceCommandRegistry
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