AnyNode

From OpenCog
Jump to: navigation, search

The AnyNode is a wildcard Node, used to bind to "anything". It is primarily used in the language learning code, where it can math "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".

Vs. Variablenode

The AnyNode is really more or less the same thing as a VariableNode, and perhaps a better long-term solution is to replace AnyNode by VariableNode. Note that VariableNodes have a typing mechanism; AnyNodes do not (thus, at this time, they are not typed).