I am new to pyke and I am trying to build a minimal system that poses a question. I tried many variants, but none of them shows me the question "Do you have a sharpening machine?". I would expect, that I have to answer this question at least once. The program only outputs the final "done". I get no error message (except for the warning below). What do I have to change?
When I call my script for the first time (compiled_krb not yet created), I get the warning:
C:\p\python-general\3.10.0\lib\site-packages\pyke\krb_compiler\kqb_parser.py:35: FutureWarning: Possible nested set at position 122
tokenizer = re.compile(r''' [ \t\f\r\v]* (?: \#.* )? (?:
writing [compiled_krb]/questions.qbc
writing [compiled_krb]/sharpening_bc.py
writing [compiled_krb]/compiled_pyke_files.py
I am working with Windows 10 and recently downloaded pyke3-1.1.1.zip. I am using python 3.10.
my driver code is this:
import sys
sys.path.append('/p/pyke/pyke-1.1.1/pyke')
from pyke import knowledge_engine, krb_traceback
##########################################
engine = knowledge_engine.engine(__file__)
engine.reset()
engine.activate('sharpening')
try:
engine.prove_goal('sharpening.has_machine($ans)')
engine.prove_goal('sharpening.has_machine_yes()')
engine.prove_goal('sharpening.has_machine(someMachine)')
except Exception:
krb_traceback.print_exc()
sys.exit(1)
print('done')
the contents of sharpening.krb is:
has_machine_yes
use has_machine(someMachine)
when
questions.has_machine_q(True)
has_machine_no
use has_machine(noMachine)
when
questions.has_machine_q(False)
my question file is:
has_machine_q($ans)
Do you have a sharpening machine?
---
$ans = yn