Created
February 27, 2019 14:36
-
-
Save noskill/e180f3700e8eda0441793e922b30f76b to your computer and use it in GitHub Desktop.
glob example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from opencog.atomspace import AtomSpace, types | |
| from opencog.type_constructors import * | |
| from opencog.atomspace import create_child_atomspace | |
| from opencog.utilities import initialize_opencog, finalize_opencog | |
| from opencog.bindlink import execute_atom, evaluate_atom | |
| a = AtomSpace() | |
| initialize_opencog(a) | |
| ListLink( | |
| ConceptNode("I"), | |
| ConceptNode("need"), | |
| ConceptNode("you"), | |
| ConceptNode("now")) | |
| ListLink( | |
| ConceptNode("they"), | |
| ConceptNode("think"), | |
| ConceptNode("I"), | |
| ConceptNode("hate"), | |
| ConceptNode("you")) | |
| love_three_globs = BindLink( | |
| VariableList( | |
| TypedVariableLink (GlobNode ("$x"), IntervalLink (NumberNode(str(0)), NumberNode(str(-1)))), | |
| TypedVariableLink (GlobNode ("$y"), | |
| TypeSetLink (TypeNode ("ConceptNode"), IntervalLink (NumberNode(str(1)), NumberNode(str(1))))), | |
| TypedVariableLink (GlobNode ("$z"), IntervalLink (NumberNode(str(0)), NumberNode(str(-1))))), | |
| ListLink( | |
| GlobNode ("$x"), | |
| ConceptNode ("I"), | |
| GlobNode ("$y"), | |
| ConceptNode ("you"), | |
| GlobNode ("$z")), | |
| ListLink( | |
| ConceptNode ("Hey!"), | |
| ConceptNode ("I"), | |
| GlobNode ("$y"), | |
| ConceptNode ("you"), | |
| ConceptNode ("also"))) | |
| print(execute_atom(a, love_three_globs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment