SpeechRecognitionResult class

Bing
 

The SpeechRecognitionResult class contains the results of a speech recognition session.

public class SpeechRecognitionResult

The SpeechRecognitionResult class has the following members.

Name

Description

Text

The recognized text of a speech recognition session.

TextConfidence

The estimated accuracy of the current SpeechRecognitionResult.

Name

Description

GetAlternates(int)

Returns the list of alternate interpretations of a speech recognition session.

The SpeechRecognitionResult class is returned by the SpeechRecognizer.RecognizeSpeechToTextAsync() method. Additional SpeechRecognitionResult instances may be returned by the SpeechRecognitionResult.GetAlternates(int) method. The class is never instantiated directly.

When a SpeechRecognizer finishes analyzing a speech session, it creates an IReadOnlyList of possible interpretations as SpeechRecognitionResult objects and ranks them in order of confidence. The SpeechRecognitionResult object with the highest TextConfidence value is ranked as item [0] in the list and is the result returned by the SpeechRecognizer.RecognizeSpeechToTextAsync() method. The GetAlternates(int) method gets the list of these alternate results.

In cases where no interpretation meets the minimum confidence threshold, the returned SpeechRecognitionResult object will have a Text value of null and a TextConfidence value of SpeechRecognitionConfidence.Rejected. This SpeechRecognitionResult object becomes the only member of the Alternates list.

System_CAPS_cautionCaution

When collecting speech results or intermediate results in a JavaScript application, quiet or unclear speech may cause the recognizeSpeechToTextAsync() method to return an error object in place of result text. To maintain smooth program flow, verify that the result 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.

Example

The following example writes the Text and TextConfidence values of a SpeechRecognitionResult to a TextBlock named ResultsText. It then gets the list of alternates and uses them to populate a ListBox named AlternatesListBox. The SelectionChanged event handler for the listbox then updates ResultsText with the alternate value selected by the user.

No code example is currently available or this language may not be supported.

Requirements

Minimum Supported Client

Windows 8

Required Extensions

Bing.Speech

Namespace

Bing.Speech

Show: