EmulateRecognize Method

Microsoft Speech Platform SDK 11

Collapse image Expand Image Copy image CopyHover image

Emulates input to the speech recognizer, using text in place of audio for synchronous speech recognition.

Overload List

  Name Description
Public method EmulateRecognize(String) Emulates input of a phrase to the speech recognizer, using text in place of audio for synchronous speech recognition.
Public method EmulateRecognize(String, EmulateOptions) Emulates input of a phrase to the speech recognizer, using text in place of audio for synchronous speech recognition, and specifies the type of recognition operation to perform.
Public method EmulateRecognize(String, CompareOptions) Emulates audio input to the recognition engine, using text in place of audio for synchronous speech recognition, and specifies how the recognizer handles Unicode comparison between the phrase and the loaded speech recognition grammars
Public method EmulateRecognize(array<RecognizedWordUnit>[]()[][], CompareOptions) Emulates input of specific words to the speech recognizer, using an array of RecognizedWordUnit objects in place of audio for synchronous speech recognition, and specifies how the recognizer handles Unicode comparison between the words and the loaded speech recognition grammars.
Public method EmulateRecognize(String, CompareOptions, EmulateOptions) Emulates audio input to the recognition engine, using text in place of audio for synchronous speech recognition, specifies how the recognizer handles Unicode comparison between the phrase and the loaded speech recognition grammars, and specifies the type of recognition operation to perform.
Public method EmulateRecognize(array<RecognizedWordUnit>[]()[][], CompareOptions, EmulateOptions) Emulates input of specific words to the speech recognizer, using an array of RecognizedWordUnit objects in place of audio for synchronous speech recognition, specifies how the recognizer handles Unicode comparison between the words and the loaded speech recognition grammars, and specifies the type of recognition operation to perform.
Top

Remarks

These methods bypass the system audio input and provide text to the recognizer as String objects or as an array of RecognizedWordUnit objects. The SpeechRecognitionEngine matches the input text to its loaded Grammar objects, and returns a RecognitionResult object.

Using the EmulateOptions parameter, you can specify one of three types of recognition operation:

  • Emulation. Uses text instead of audio as input to the speech recognition engine to perform recognition.

  • IdentifyConfusion. Identifies phrases in a grammar that may generate false acceptances on recognition because of similarity to other phrases in the grammar.

  • Simulation. Creates an 'idealized' audio representation of the input phrase (based on the speech recognition engine's lexicon and acoustic model), and then performs recognition on the idealized audio.

See EmulateOptions for more information.

Use the SetInputToNull()()()() method to disable audio input to the speech recognition engine during emulation operations.

The speech recognizer raises the SpeechDetected, SpeechHypothesized, SpeechRecognitionRejected, and SpeechRecognized events as if the recognition operation is not emulated. The recognizer ignores new lines and extra white space and treats punctuation as literal input.

Note Note

The RecognitionResult object generated by the speech recognizer in response to emulated input has a value of nullNothingnullptrunita null reference (Nothing in Visual Basic) for its Audio property.

To emulate asynchronous recognition, use the EmulateRecognizeAsync method.

Examples

In the following example, an application obtains text input through a Textbox, and uses it to emulate speech input.

  Copy imageCopy Code
private void EmulateTextBox_KeyPress(object sender, KeyPressEventArgs eventArgs) 
{
  if ((Keys)eventArgs.KeyChar == Keys.Enter) 
  {
    RecognitionResult result = _recognitionEngine.EmulateRecognize(_emulateTextBox.Text);
  }
}


// Emulate a button click in the emulateTextBox.
private void _emulateButton_Click(object sender, EventArgs e) 
{
  RecognitionResult result = _recognitionEngine.EmulateRecognize(_emulateTextBox.Text);
}

See Also