Partilhar via


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

SpeechRecognitionEngine.Recognize Method

Include Protected Members
Include Inherited Members

Starts a synchronous speech recognition operation.

Overload List

  Name Description
Public method Recognize() Performs a synchronous speech recognition operation.
Public method Recognize(TimeSpan) Performs a synchronous speech recognition operation with a specified initial silence timeout period.

Top

Remarks

These methods perform a single, synchronous recognition operation. The recognizer performs this operation against its loaded and enabled speech recognition grammars.

During a call to this method, the recognizer can raise the following events:

The recognizer does not raise the RecognizeCompleted event when using one of the Recognize() methods.

The Recognize methods return a RecognitionResult object, or a null reference (Nothing in Visual Basic) if the operation is not successful.

A synchronous recognition operation can fail for the following reasons:

  • Speech is not detected before the timeout intervals expire for the BabbleTimeout or InitialSilenceTimeout properties, or for the initialSilenceTimeout parameter of the Recognize(TimeSpan) method.

  • The recognition engine detects speech but finds no matches in any of its loaded and enabled Grammar objects.

To modify how the recognizer handles the timing of speech or silence with respect to recognition, use the BabbleTimeout, InitialSilenceTimeout, EndSilenceTimeout, and EndSilenceTimeoutAmbiguous properties.

The SpeechRecognitionEngine must have at least one Grammar object loaded before performing recognition. To load a speech recognition grammar, use the LoadGrammar or LoadGrammarAsync method.

To perform asynchronous recognition, use one of the RecognizeAsync methods.

See Also

Reference

SpeechRecognitionEngine Class

SpeechRecognitionEngine Members

Microsoft.Speech.Recognition Namespace