Grammar.SpeechRecognized Event

The event raised when the current grammar has been used by the recognition engine to detect speech and find one or more phrases with sufficient confidence levels.

Namespace: Microsoft.Speech.Recognition
Assembly: Microsoft.Speech (in microsoft.speech.dll)

Syntax

'Declaration

Example

Prior to being loaded, a handler is added to a grammar (changeColorGrammar) so that up recognition using that grammar the color of the application is changed.

changeColorGrammar.SpeechRecognized +=
    delegate(object sender, SpeechRecognizedEventArgs e) {
        // Retrieve the value of the semantic property.
        if (e.Result.Semantics.ContainsKey("color")) {
            string colorName = (string)e.Result.Semantics["color"].Value;
            BackColor = Color.FromName(colorName);
        } else {
            MessageBox.Show("Grammar does not support color change");
        }
    };

_recognizer.LoadGrammar(changeColorGrammar);

Remarks

The SpeechRecognizer class also supports a SpeechRecognized event (SpeechRecognized).

Handlers subscribed to the SpeechRecognized event are always called prior calling the handlers for E:Microsoft.Speech.Recognition.SpeechRecognizer.SpeechRecognized.

Any tasks specific to a particular grammar should always be handled by SpeechRecognized event handlers..

The confidence level cut off for recognition is an arbitrary feature of any particular recognition engine and is not settable by applications

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

Grammar Class
Grammar Members
Microsoft.Speech.Recognition Namespace