SpeechRecognizer.RecognizerResultReceived event

 

The RecognizerResultReceived event is raised when the SpeechRecognizer identifies a possible interpretation of user speech.

Syntax

public event Windows.Foundation.TypedEventHandler<SpeechRecognizer,SpeechRecognitionResultReceivedEventArgs> RecognizerResultReceived

Remarks

The RecognizerResultReceived event is raised once for each possible interpretation created during the Listening and Thinking phases of the current speech recognition session, with the SpeechRecognitionResultRecievedEventArgs.IsHypothesis property set to true. The event is then raised again at the end of the Thinking phase with IsHypothesis set to false.

Example

The following event handler writes intermediate results to a TextBlock (XAML) or DIV (HTML) named IntermediateResults.

void SR_RecognizerResultReceived(SpeechRecognizer sender,
    SpeechRecognitionResultReceivedEventArgs args)
{
    IntermediateResults.Text = args.Text;
}
function SR_RecognizerResultReceived(args) {
    if (typeof (args.text) == "string") {
        document.getElementById("IntermediateResults").innerText = args.text;
    }
}

Caution

When collecting speech results or intermediate results in a JavaScript application, quiet or unclear speech may cause this event to receive an error object in place of args.text. To maintain smooth program flow, verify that args.text is a string before attempting to read it. For more information, see How to: Add the Bing Speech Recognition Control to an application with a custom UI.

Requirements

Minimum Supported Client

Windows 8

Required Extensions

Bing.Speech

Namespace

Bing.Speech