Expand description

Speech recognition API.

Recognizer

The entry point for speech recognition is the Recognizer, which encapsulates an in-process speech recognition engine. You generally won’t need more than one instance of the recognizer.

Context

The recognizer can have one or more recognition contexts. This module provides two variants of contexts:

  • SyncContext will block the current thread until the engine recognizes a phrase, or until the given timeout.
  • EventfulContext will call the supplied event handler whenever the engine recognizes a phrase.

For asynchronous recognition, see the tokio module.

Grammar

Each context can have one or more grammars loaded into it. A grammar consists of one or more rules that define what phrases the engine can recognize. You can enable or disable the whole grammar, or individual rules in it by their name.

Structs

Provides the common API shared across different kinds of contexts.

A recognition context that calls the supplied event handler every time the engine recognizes a phrase in it.

A set of rules that define phrases that can be recognized.

Helper type that constructs a grammar from a set of top-level rules.

A successfully recognized phrase.

The in-process speech recognition engine.

Specifies the bounds for how many times the target rule in a Rule::Repeat can be repeated.

Allocation arena for grammar rules.

A tree of values that forms part of the semantic information for a recognized phrase.

A recognition context that blocks the current thread until the engine recognizes a phrase.

Enums

Specifies where the input for speech recognition should come from.

A rule that defines one or more phrases or fragments that can be recognized by the engine.

A value that forms part of the semantic information for a recognized phrase.

Traits

The handler EventfulContext will call.

A string type that can be borrowed as an OsStr.