Note
Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.
SemanticValue.Value Property
Gets the information contained in the current SemanticValue.
Namespace: Microsoft.Speech.Recognition
Assembly: Microsoft.Speech (in Microsoft.Speech.dll)
Syntax
'Declaration
Public Property Value As Object
Get
Friend Set
'Usage
Dim instance As SemanticValue
Dim value As Object
value = instance.Value
public Object Value { get; internal set; }
Property Value
Type: System.Object
Returns a Object instance containing the information stored in the current SemanticValue instance.
Remarks
Recognition results which do not make use of semantic parsing always have a Value of a null reference (Nothing in Visual Basic) and a Count property of zero.
Examples
The example below is used to recursively traverse and then display (as a TreeNodeCollection) information, including confidence, or the nodes making up the tree structure of the semantics used to recognize a phrase. The use of Value is highlighted.
internal static void CreateSemanticsTreeNodes(TreeNodeCollection nodes,
SemanticValue semantics,
String name) {
string semanticsText = String.Format(" {0} ( Confidence {1})",
name,semantics.Confidence);
//Put integers as hex
if (semantics.Value == null ){semanticsText = semanticsText + " = null";}else if (semantics.Value.GetType() == typeof(int)) {semanticsText = String.Format("{0} = {1:X} ", semanticsText, semantics.Value);} else {semanticsText = semanticsText + " = "+ semantics.Value.ToString();}
TreeNode semanticsNode = new TreeNode(semanticsText);
foreach (KeyValuePair<String, SemanticValue> child in semantics) {
CreateSemanticsTreeNodes(semanticsNode.Nodes, child.Value, child.Key);
}
nodes.Add(semanticsNode);
// }
}