RecognitionResult Class


Contains detailed information about input that was recognized by instances of SpeechRecognitionEngine or SpeechRecognizer.

public ref class RecognitionResult sealed : System::Speech::Recognition::RecognizedPhrase, System::Runtime::Serialization::ISerializable
public sealed class RecognitionResult : System.Speech.Recognition.RecognizedPhrase, System.Runtime.Serialization.ISerializable
type RecognitionResult = class
    inherit RecognizedPhrase
    interface ISerializable
Public NotInheritable Class RecognitionResult
Inherits RecognizedPhrase
Implements ISerializable


The following example shows a handler for the SpeechRecognized event of a SpeechRecognitionEngine or SpeechRecognizer object, and some of the information about the associated RecognitionResult.

// Handle the SpeechRecognized event.   
void SpeechRecognizedHandler(object sender, SpeechRecognizedEventArgs e)  
  if (e.Result == null) return;  

  // Add event handler code here.  

  // The following code illustrates some of the information available  
  // in the recognition result.  
  Console.WriteLine("Grammar({0}), {1}: {2}",  
    e.Result.Grammar.Name, e.Result.Audio.Duration, e.Result.Text);  

  // Display the semantic values in the recognition result.  
  foreach (KeyValuePair<String, SemanticValue> child in e.Result.Semantics)  
    Console.WriteLine(" {0} key: {1}",  
      child.Key, child.Value.Value ?? "null");  

  // Display information about the words in the recognition result.  
  foreach (RecognizedWordUnit word in e.Result.Words)  
    RecognizedAudio audio = e.Result.GetAudioForWordRange(word, word);  
    Console.WriteLine(" {0,-10} {1,-10} {2,-10} {3} ({4})",  
      word.Text, word.LexicalForm, word.Pronunciation,  
      audio.Duration, word.DisplayAttributes);  

  // Display the recognition alternates for the result.  
  foreach (RecognizedPhrase phrase in e.Result.Alternates)  
    Console.WriteLine(" alt({0}) {1}", phrase.Confidence, phrase.Text);  


This class derives from RecognizedPhrase and provides detailed information about speech recognition, including the following:

  • The Grammar property references the Grammar that the recognizer used to identify the speech.

  • The Text property contains the normalized text for the phrase. For more information about text normalization, see ReplacementText.

  • The Semantics property references the semantic information contained in the result. The semantic information is a dictionary of the key names and associated semantic data.

  • The Alternates property contains a collection of RecognizedPhrase objects that represent other candidate interpretations of the audio input. See Alternates for additional information.

  • The Words property contains an ordered collection of RecognizedWordUnit objects that represent each recognized word in the input. Each RecognizedWordUnit contains display format, lexical format, and pronunciation information for the corresponding word.

Certain members of the SpeechRecognitionEngine, SpeechRecognizer, and Grammar classes can generate a RecognitionResult. For more information, see the following methods and events.

For more information about recognition events, see Using Speech Recognition Events.



Gets the collection of possible matches for input to the speech recognizer.


Gets the audio associated with the recognition result.


Gets a value, assigned by the recognizer, that represents the likelihood that a RecognizedPhrase matches a given input.

(Inherited from RecognizedPhrase)

Gets the Grammar that the speech recognizer used to return the RecognizedPhrase.

(Inherited from RecognizedPhrase)

Gets the identifier for the homophone group for the phrase.

(Inherited from RecognizedPhrase)

Gets a collection of the recognition alternates that have the same pronunciation as this recognized phrase.

(Inherited from RecognizedPhrase)

Gets information about the text that the speech recognizer changed as part of speech-to-text normalization.

(Inherited from RecognizedPhrase)

Gets the semantic information that is associated with the recognized phrase.

(Inherited from RecognizedPhrase)

Gets the normalized text generated by a speech recognizer from recognized input.

(Inherited from RecognizedPhrase)

Gets the words generated by a speech recognizer from recognized input.

(Inherited from RecognizedPhrase)



Returns a semantic markup language (SML) document for the semantic information in the RecognizedPhrase object.

(Inherited from RecognizedPhrase)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetAudioForWordRange(RecognizedWordUnit, RecognizedWordUnit)

Gets a section of the audio that is associated with a specific range of words in the recognition result.


Serves as the default hash function.

(Inherited from Object)

Gets the Type of the current instance.

(Inherited from Object)

Creates a shallow copy of the current Object.

(Inherited from Object)

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

Populates a SerializationInfo instance with the data needed to serialize the target object.

Applies to

See also