AnyNode

From OpenCog
Jump to: navigation, search

The AnyNode is a wildcard Node, used to bind to "anything". It provides the base class for VariableNode, as it is a generic, untyped, non-lexical naming tool (just like a variable), but more general, as it lies outside the (lexical) variable type system.

As a wildcard

It is primarily used in the language learning code, where it can match "any" word.

It is useful for storing probabilities and sums over counts. Thus, for example, one may consider pairs of words that are next to each other. The word pair "for example" would be expressed as:

EvaluationLink
   PredicateNode "pair"
   ListLink
      WordNode "for"
      WordNode "example"

Suppose one is interested in the set of all word pairs where the second word is "example". or rather, suppose one is interested in the size, probability or mutual information of this set. This statistical information can be captured like so:

EvaluationLink  <TV>
   PredicateNode "pair"
   ListLink
      AnyNode "*"
      WordNode "example"

where the TruthValue <TV> contains the statistical counts, averages, mutual information, etc. Statistics for all word pairs would be held in:

EvaluationLink  <TV>
   PredicateNode "pair"
   ListLink
      AnyNode "*"
      AnyNode "*"


Statistics for dependency parses resulting from natural language parsing can be represented like so:

EvaluationLink  <TV>
   LinkGrammarRelationshipNode "D"
   ListLink
      AnyNode "*"
      WordNode "example"

Here, the <TV> holds the counts for all words that connected with the "D" link-grammar link type ("D" for "determiner", "a", "an", "the"...) to the word "example".

AnyNode Vs. Variablenode

The AnyNode is almost the same thing as a VariableNode; it is slightly more general and provides a base class for the VariableNode.