Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
 Result Property

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
RecognitionEventArgs..::.Result Property

Read only property returning about a speech recognition operation that generated a SpeechHypothesized, SpeechRecognized or SpeechRecognitionRejected event.

Namespace:  System.Speech.Recognition
Assembly:  System.Speech (in System.Speech.dll)
Visual Basic (Declaration)
Public ReadOnly Property Result As RecognitionResult
Visual Basic (Usage)
Dim instance As RecognitionEventArgs
Dim value As RecognitionResult

value = instance.Result
C#
public RecognitionResult Result { get; }
Visual C++
public:
property RecognitionResult^ Result {
    RecognitionResult^ get ();
}
JScript
public function get Result () : RecognitionResult

Property Value

Type: System.Speech.Recognition..::.RecognitionResult
Returns the RecognitionResult, which is derived from RecognizedPhrase and contains full information about the a phrase returned by an Windows Desktop Speech Recognition Technology recognition operation.

The returned RecognitionResult provides information about a candidate phrase found by a speech recognition operation through the methods it inherited from RecognizedPhrase.

A list of all candidates, including the best candidate can be obtained from the Alternates property.

The example below shows the use Result to obtain an instance of RecognitionResult, which is then used to display information about the results of a speech recognition operation.

       // Displays the semantics, rules, and alternates of the result.
        private void DisplayResult(RecognitionEventArgs eventArgs)
        {

            // Clear results, semantic XML, semantics tree, and alternates.
            _recognitionSmlBrowser.Navigate("about:blank");
            _semanticsTreeView.Nodes.Clear();
            _alternatesListBox.Items.Clear();
            _recognitionInfo.Text = null;
            _recognizedTextDisplay.Text = null;


            //Obtain result from RecognitionEventArg passed in.

            
            if (eventArgs != null && eventArgs.Result != null)
            {
                RecognitionResult result = eventArgs.Result;
                //Set Text color on the basis of the event type passed in.
                _recognitionInfo.Text = null;
                switch (eventArgs.GetType().ToString())
                {

                    case "System.Speech.Recognition.SpeechHypothesizedEventArgs":
                       _recognizedTextDisplay.ForeColor = Color.Black;
                        _recognizedTextDisplay.Text = result.Text;
                        _recognitionInfo.Text = null;
                        break;
                    case "System.Speech.Recognition.SpeechRecognitionRejectedEventArgs":
                        _recognizedTextDisplay.ForeColor = Color.OrangeRed;
                        _recognizedTextDisplay.Text ="Unable to Recognize Input";
                        DisplaySemanticsSML(result);
                        DisplaySemanticsTreeView(result);
                        _recognitionInfo.Text = null;
                        break;
                    case "System.Speech.Recognition.SpeechRecognizedEventArgs":
                        _recognizedTextDisplay.ForeColor = Color.Green;
                        _recognizedTextDisplay.Text = result.Text;
                        _recognitionInfo.Text =
                            "Confidence Level:    " + result.Confidence + Environment.NewLine
                          + "Recognizing Grammar: " + result.Grammar.Name + Environment.NewLine
                          + ((result.Grammar.RuleName != null) ? ("Recognizing Rule   : " + result.Grammar.RuleName) : "");
                        DisplaySemanticsSML(result);
                        DisplaySemanticsTreeView(result);
                        break;
                    default:
                        _recognizedTextDisplay.ForeColor = Color.Black;
                        break;
                }

                _recognizedTextDisplay.Show();
                _recognitionInfo.Show();

                DisplayAlternates(result);

            }
        }

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker