Confidence Property

Microsoft Speech Platform SDK 11

Collapse imageExpand ImageCopy imageCopyHover image

Returns a relative measure of the certainty as to the correctness of the semantic parsing that returned the current instance of SemanticValue.

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

Syntax

Visual Basic (Declaration)
Public ReadOnly Property Confidence As Single
	Get
Visual Basic (Usage)
Dim instance As SemanticValue
Dim value As Single

value = instance.Confidence
C#
public float Confidence { get; }

Property Value

Type: System..::..Single

Returns a float that is a relative measure of the certainty as to the correctness of the semantic parsing that returned the current instance of SemanticValue.

Remarks

The SemanticValue..::..Confidence property, which returns a measure of the correctness of semantic parsing, should not be confused with the RecognizedPhrase..::..Confidence property, which returns a measure of the accuracy of speech recognition.

Examples

The following example is used to recursively traverse and then display information (including confidence) as a TreeNodeCollection, or as the nodes making up the tree structure of the semantics used to recognize a phrase.

 Copy imageCopy Code
internal static void CreateSemanticsTreeNodes(
        TreeNodeCollection nodes,
        SemanticValue semantics,
        String name) 
{
  string semanticsText = 
      String.Format("  {0}  (Confidence {1})", name,semantics.Confidence);

  // Format integers as hexadecimal.
  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);
}

See Also