Steps to Using Pyke
- You provide the following to Pyke's knowledge engine:
- Repeat for each specific use case:
- You provide a set of statements describing this specific use case to Pyke.
- You select which set of rules apply to this use case.
- Pyke automatically runs all of the selected forward-chaining rules that apply to the statements that you've given to it to deduce new statements.
- You ask Pyke a question by having it prove a goal (which is just
another statement). This goal may include pattern variables that
allow you to ask "for what values is this statement true?".
- Pyke runs the selected backward-chaining rules against the statements that it has in order to figure out the answer to your question.
- Your backward-chaining rules may also ask your end user questions and run commands.
- You may have written Python code at the end of some of your backward-chaining rules. For each such rule, Pyke has compiled this Python code into a Python function called a plan which it has attached to the rule.
- Once Pyke finds an answer to your question, it gathers all of the plan functions of the rules that it used to find your answer into a complete function call graph. The plan functions are linked together mirroring the way that the rules were linked together to find your answer. In this way, you can write high-level compilers that assemble together and configure a set of Python functions to solve specific problems.
- Pyke returns the top Python function of this function call graph as a standard Python function along with the answer to your question. You may call this function as may times as you like. You may also pickle the function so that you can send it to another program or save it to disk. You only need one small Pyke module to load and run these pickles.
- You reset Pyke to clear out all of these case specific statements and prepare it for the next use case.