KeywordRecognizer Class

A keyword recognizer.

Inheritance
builtins.object
KeywordRecognizer

Constructor

KeywordRecognizer(audio_config: AudioConfig | None = None)

Parameters

Name Description
audio_config

The config for audio input. This parameter is optional. If it is None or not provided, the default microphone device will be used for audio input.

Default value: None

Methods

recognize_once_async

Asynchronously initiates keyword recognition operation.

stop_recognition_async

Asynchronously terminates ongoing keyword recognition operation.

recognize_once_async

Asynchronously initiates keyword recognition operation.

recognize_once_async(model: KeywordRecognitionModel) -> ResultFuture

Parameters

Name Description
model
Required

The keyword recognition model that specifies the keyword to be recognized.

Returns

Type Description

A future that is fulfilled once recognition has been initialized.

stop_recognition_async

Asynchronously terminates ongoing keyword recognition operation.

stop_recognition_async()

Returns

Type Description

A future that is fulfilled once recognition has been stopped.

Attributes

canceled

Signal for events containing canceled keyword recognition results.

Callbacks connected to this signal are called with a SpeechRecognitionCanceledEventArgs instance as the single argument.

properties

A collection of properties and their values defined for this KeywordRecognizer.

recognized

Signal for events containing final keyword recognition results (indicating a successful recognition attempt).

Callbacks connected to this signal are called with a KeywordRecognitionEventArgs instance as the single argument.