Bagikan melalui


KeywordRecognizer.RecognizeOnceAsync(KeywordRecognitionModel) Method

Definition

Starts a keyword recognition session as an asynchronous operation.

public System.Threading.Tasks.Task<Microsoft.CognitiveServices.Speech.KeywordRecognitionResult> RecognizeOnceAsync (Microsoft.CognitiveServices.Speech.KeywordRecognitionModel model);
member this.RecognizeOnceAsync : Microsoft.CognitiveServices.Speech.KeywordRecognitionModel -> System.Threading.Tasks.Task<Microsoft.CognitiveServices.Speech.KeywordRecognitionResult>
Public Function RecognizeOnceAsync (model As KeywordRecognitionModel) As Task(Of KeywordRecognitionResult)

Parameters

model
KeywordRecognitionModel

The KeywordRecognitionModel that describes the keyword we want to detect.

Returns

A future that resolves to a KeywordRecognitionResult that resolves once a keyword is detected.

Remarks

The keyword recognition session lasts until the first keyword is recognized, or **StopRecognitionAsync** is called.

When a keyword is recognized, a Recognized event fires and the task completes. To detect another keyword, call the method again.

If no keyword is detected in the input, the task will never resolve unless StopRecognitionAsync() is called.

See also: Get started with Custom Keyword

Applies to