Export (0) Print
Expand All

RecognizedPhrase.Semantics Property

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

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

public SemanticValue Semantics { get; }

Property Value

Type: System.Speech.Recognition.SemanticValue
The semantic information associated with the recognized phrase.

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 Understanding Semantic Results and the SemanticResultKey and SemanticResultValue classes.

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.

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;
}

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft