SpeechRecognitionEngine.EmulateRecognizeAsync Method (RecognizedWordUnit[], CompareOptions)


Emulates input of specific words to the speech recognizer, using an array of RecognizedWordUnit objects in place of audio for asynchronous speech recognition, and specifies how the recognizer handles Unicode comparison between the words and the loaded speech recognition grammars.

Namespace:   System.Speech.Recognition
Assembly:  System.Speech (in System.Speech.dll)

public void EmulateRecognizeAsync(
	RecognizedWordUnit[] wordUnits,
	CompareOptions compareOptions


Type: System.Speech.Recognition.RecognizedWordUnit[]

An array of word units that contains the input for the recognition operation.

Type: System.Globalization.CompareOptions

A bitwise combination of the enumeration values that describe the type of comparison to use for the emulated recognition operation.

Exception Condition

The recognizer has no speech recognition grammars loaded, or the recognizer has an asynchronous recognition operation that is not yet complete.


wordUnits is null.


wordUnits contains one or more null elements.


compareOptions contains the IgnoreNonSpace, IgnoreSymbols, or StringSort flag.

The speech recognizer raises the SpeechDetected, SpeechHypothesized, SpeechRecognitionRejected, and SpeechRecognized events as if the recognition operation is not emulated. When the recognizer completes the asynchronous recognition operation, it raises the EmulateRecognizeCompleted event.

The recognizer uses compareOptions when it applies grammar rules to the input phrase. The recognizers that ship with Vista and Windows 7 ignore case if the OrdinalIgnoreCase or IgnoreCase value is present. The recognizers always ignore the character width and never ignore the Kana type. The recognizers also ignore new lines and extra white space and treat punctuation as literal input. For more information about character width and Kana type, see the CompareOptions enumeration.

.NET Framework
Available since 3.0
Return to top