次の方法で共有


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

SemanticValue.Confidence Property

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

'Declaration
Public ReadOnly Property Confidence As Single
    Get
'Usage
Dim instance As SemanticValue
Dim value As Single

value = instance.Confidence
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.

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

Reference

SemanticValue Class

SemanticValue Members

Microsoft.Speech.Recognition Namespace