StrengthOfLink

From OpenCog
(Redirected from StrengthOf)
Jump to: navigation, search

The StrengthOfLink and ConfidenceOfLink are a executable Links that returns a numeric value when executed: they returns a single floating-point number, the strength/confidence of the TruthValue of the atom that they wrap. They are useful for representing numeric computations with TruthValues, and then actually performing that computation, when executed.

If the wrapped atom is evaluatable, then it is evaluated first, so as to obtain a truth value.

Examples

It is straight-forward to obtain the TruthValue of a constant Atom:

(use-modules (opencog) (opencog exec))

(Concept "foo" (SimpleTruthValue 0.6 0.3))

(cog-execute! (StrengthOf (Concept "foo")))
(cog-execute! (ConfidenceOf (Concept "foo")))

Numeric computations are possible with the returned values:

(cog-execute! (Minus (Number 1) (StrengthOf (Concept "foo"))))

Arguments are evaluated before the TruthValue is accessed:

Tutorials and additional examples can be found in the /examples directory.

See also