Dela via


SemanticValue.Confidence Property

Definition

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

public:
 property float Confidence { float get(); };
public float Confidence { get; }
member this.Confidence : single
Public ReadOnly Property Confidence As Single

Property Value

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

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.

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

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.

Applies to