SpeechRecognitionEngine.RecognizeCompleted Event
The event raised when an asynchronous recognition operation completes.
Namespace: Microsoft.Speech.Recognition
Assembly: Microsoft.Speech (in microsoft.speech.dll)
Syntax
'Declaration
Example
The example below show a simple anonymous method used as the handler for RecognizeCompleted. The handler stores the result of the recognition operation, if Result is not null and updates a state variable. If an error condition exists, a message is sent to the end user.
_recognizer.RecognizeCompleted += delegate(object sender, RecognizeCompletedEventArgs completedEventArgs) {
_recognitionDone = true;
if (completedEventArgs.Result != null) {
_completedEventArgs = completedEventArgs;
_recognitionSuccess = true;
} else {
_completedEventArgs = null;
_recognitionSuccess = false;
MessageBox.Show(String.Format("Recognition failed\n",
"InitialSilenceTimeout: {0}\n",
"BabbleTimeout: {0}\n",
"InputStreamEnded: {2}\n",
completedEventArgs.InitialSilenceTimeout,
completedEventArgs.BabbleTimeout,
completedEventArgs.InputStreamEnded));
}
};
Remarks
RecognizeCompleted events are generated on completion of an asynchronous recognition operation (initiated by calls to RecognizeAsync).
An instance of RecognizeCompletedEventArgs is passed to the RecognizeCompleted handler, which can use the instance to obtain an RecognitionResult instance (P:Microsoft.Speech.Recognition.RecognizeCompletedEventArgs.Result), which will be null if recognition failed due either to time out or grammar failure.
To obtain details on the best rejected recognition candidates, an application must have a handler for SpeechRecognitionRejected.
If a timeout occurred, or audio input ended can be determined from the InitialSilenceTimeout, BabbleTimeout, or InputStreamEnded properties on the instance of RecognizeCompletedEventArgs passed to the handler.
Platforms
Development Platforms
Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition
Target Platforms
See Also
Reference
SpeechRecognitionEngine Class
SpeechRecognitionEngine Members
Microsoft.Speech.Recognition Namespace