RecognizedPhrase RecognizedPhrase RecognizedPhrase RecognizedPhrase Class


Contains detailed information, generated by the speech recognizer, about the recognized input.

public ref class RecognizedPhrase
public class RecognizedPhrase
type RecognizedPhrase = class
Public Class RecognizedPhrase


The following example shows a handler for a SpeechRecognitionEngine.SpeechRecognized, SpeechRecognizer.SpeechRecognized, or Grammar.SpeechRecognized event and some of the information associated with the RecognitionResult object. The RecognitionResult class derives from the RecognizedPhrase class.

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("Recognition result summary:");  
    "  Recognized phrase: {0}\n" +   
    "  Confidence score {1}\n" +   
    "  Grammar used: {2}\n",   
    e.Result.Text, e.Result.Confidence, e.Result.Grammar.Name);  

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

  // Display information about the words in the recognition result.  
  Console.WriteLine("  Word summary: ");  
  foreach (RecognizedWordUnit word in e.Result.Words)  
      "    Lexical form ({1})" +  
      " Pronunciation ({0})" +  
      " Display form ({2})",  
      word.Pronunciation, word.LexicalForm, word.DisplayAttributes);  

  // Display information about the audio in the recognition result.  
  Console.WriteLine("  Input audio summary:\n" +  
    "    Candidate Phrase at:       {0} mSec\n" +  
    "    Phrase Length:             {1} mSec\n" +  
    "    Input State Time:          {2}\n" +  
    "    Input Format:              {3}\n",  

  // Display information about the alternate recognitions in the recognition result.  
  Console.WriteLine("  Alternate phrase collection:");  
  foreach (RecognizedPhrase phrase in e.Result.Alternates)  
    Console.WriteLine("    Phrase: " + phrase.Text);  
    Console.WriteLine("    Confidence score: " + phrase.Confidence);  


This class contains detailed information about words and phrases processed during speech recognition operations, including the following:

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

  • The Text property contains the normalized text for the phrase.

  • 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 Words property contains an ordered collection of RecognizedWordUnit objects that represent each recognized word in the input. Each word unit contains display format, lexical format, and pronunciation information for the corresponding word.

  • The ReplacementWordUnits property contains information about specialized word substitution.

  • The Homophones and HomophoneGroupId properties contain information about recognition alternates that have the same or similar pronunciation.

  • The value of the Confidence property indicates the degree of certainty, assigned by the speech recognizer, that a recognized phrase matches the input.

The speech recognizer returns recognition results in a RecognitionResult object, which inherits from RecognizedPhrase. The recognition result Alternates property contains an ordered collection of RecognizedPhrase objects, each of which is a possible match for the input to the recognizer.


Confidence Confidence Confidence Confidence

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

Grammar Grammar Grammar Grammar

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

HomophoneGroupId HomophoneGroupId HomophoneGroupId HomophoneGroupId

Gets the identifier for the homophone group for the phrase.

Homophones Homophones Homophones Homophones

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

ReplacementWordUnits ReplacementWordUnits ReplacementWordUnits ReplacementWordUnits

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

Semantics Semantics Semantics Semantics

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

Text Text Text Text

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

Words Words Words Words

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


ConstructSmlFromSemantics() ConstructSmlFromSemantics() ConstructSmlFromSemantics() ConstructSmlFromSemantics()

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

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also