We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi I want to declare new facts in rule RHS. Is there an example of this?
Thanks!
The text was updated successfully, but these errors were encountered:
Hi,
Please see;
''' from pyknow import *
class Greetings(KnowledgeEngine): @DefFacts() def _initial_action(self): yield Fact(action="greet")
@Rule(Fact(action='greet'), NOT(Fact(name=W()))) def ask_name(self): self.declare(Fact(name=input("What's your name? "))) @Rule(Fact(action='greet'), NOT(Fact(location=W()))) def ask_location(self): self.declare(Fact(location=input("Where are you? "))) @Rule(Fact(action='greet'), Fact(name=MATCH.name), Fact(location=MATCH.location)) def greet(self, name, location): print("Hi %s! How is the weather in %s?" % (name, location))
engine = Greetings() engine.reset() # Prepare the engine for the execution. engine.run() # Run it! '''
From the documentation :)
I think this is what you are after?
Sorry, something went wrong.
No branches or pull requests
Hi
I want to declare new facts in rule RHS. Is there an example of this?
Thanks!
The text was updated successfully, but these errors were encountered: