Export (0) Print
Expand All

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: System.Speech.Recognition
Assembly: System.Speech (in system.speech.dll)

public event EventHandler<SpeechRecognizedEventArgs> SpeechRecognized
/** @event */
public void add_SpeechRecognized (EventHandler<SpeechRecognizedEventArgs> value)

/** @event */
public void remove_SpeechRecognized (EventHandler<SpeechRecognizedEventArgs> value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.

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

Handlers subscribed to the SpeechRecognized event are always called prior calling the handlers for E:System.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

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);

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft