Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

PyKnow: Expert Systems for Python

License

NotificationsYou must be signed in to change notification settings

buguroo/pyknow

Repository files navigation

https://travis-ci.org/buguroo/pyknow.svg?branch=masterDocumentation Statuscodecov.io

PyKnow is a Python library for building expert systems strongly inspiredbyCLIPS.

fromrandomimportchoicefrompyknowimport*classLight(Fact):"""Info about the traffic light."""passclassRobotCrossStreet(KnowledgeEngine):@Rule(Light(color='green'))defgreen_light(self):print("Walk")@Rule(Light(color='red'))defred_light(self):print("Don't walk")@Rule(AS.light<<Light(color=L('yellow')|L('blinking-yellow')))defcautious(self,light):print("Be cautious because light is",light["color"])
>>>engine=RobotCrossStreet()>>>engine.reset()>>>engine.declare(Light(color=choice(['green','yellow','blinking-yellow','red'])))>>>engine.run()Becautiousbecauselightisblinking-yellow

You can find some more examples onGitHub.


[8]ページ先頭

©2009-2025 Movatter.jp