Semantics Property

Microsoft Speech Platform SDK 11

Collapse image Expand Image Copy image CopyHover image

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

Namespace:  Microsoft.Speech.Recognition
Assembly:  Microsoft.Speech (in Microsoft.Speech.dll)

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Semantics As SemanticValue
	Get
Visual Basic (Usage)
Dim instance As RecognizedPhrase
Dim value As SemanticValue

value = instance.Semantics
C#
public SemanticValue Semantics { get; }

Property Value

Type: Microsoft.Speech.Recognition..::..SemanticValue

The semantic information associated with the recognized phrase.

Remarks

A speech recognition grammar can include semantic information. When a speech recognizer generates a recognition result for such a grammar, the semantic information might be included in the recognition result, according to the rules of the grammar and the input to the recognizer. For more information about semantic information, see Create and Access Semantic Content (Microsoft.Speech) and the and the SemanticResultKey and SemanticResultValue classes.

Examples

The following example defines a method that gets specific semantic information from a recognized phrase. When this method returns, it contains the value for the semantic key, or null if the value was not retrieved. This method checks only for top-level keys. Since the semantic information is contained in a tree of values, lower-level keys must be accessed through the returned semantic value.

 Copy imageCopy Code
static bool TryGetSemanticValue(
      RecognizedPhrase phrase, string key, out SemanticValue value)
{
  value = null;
  bool found = phrase.Semantics.ContainsKey(key);
  if (found)
  {
    value = phrase.Semantics[key];
  }

  return found;
}

See Also