通过


SemanticValue.Value 属性

定义

一个只读属性,返回当前 SemanticValue中包含的信息。

public:
 property System::Object ^ Value { System::Object ^ get(); };
public object Value { get; }
member this.Value : obj
Public ReadOnly Property Value As Object

属性值

返回一个 Object 实例,其中包含存储在当前 SemanticValue 实例中的信息。

示例

以下示例用于以递归方式遍历,然后将信息(包括置信度)显示为一个 TreeNodeCollection,或用作构成用于识别短语的语义的树结构的节点。

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

注解

不使用语义分析的识别结果始终具有一个Valuenull属性和一个Count零的属性。

适用于