Skip to main content

Expert Systems for Python

Project description

pypi version tests Documentation Status codecov.io

Experta is a Python library for building expert systems strongly inspired by CLIPS.

from random import choice
from experta import *


class Light(Fact):
    """Info about the traffic light."""
    pass


class RobotCrossStreet(KnowledgeEngine):
    @Rule(Light(color='green'))
    def green_light(self):
        print("Walk")

    @Rule(Light(color='red'))
    def red_light(self):
        print("Don't walk")

    @Rule(AS.light << Light(color=L('yellow') | L('blinking-yellow')))
    def cautious(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()
Be cautious because light is blinking-yellow

Migrating from Pyknow

Experta is a Pyknow fork. Just replace any pyknow references in your code/examples to experta and everything should work the same.

Examples

You can find some more examples on GitHub.

TODO

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

experta-1.8.2.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

experta-1.8.2-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file experta-1.8.2.tar.gz.

File metadata

  • Download URL: experta-1.8.2.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.8

File hashes

Hashes for experta-1.8.2.tar.gz
Algorithm Hash digest
SHA256 1605e2e8cd63f0448620639db3ed23bd588aaaec3e9059004c918cf246be4eb9
MD5 3039397d9c2edfcfebf40ea7f2347c6a
BLAKE2b-256 50344af5af88cf1c90cd15aeb6b01be6ac4795fe16b48c8cd2f50c240b93cf48

See more details on using hashes here.

File details

Details for the file experta-1.8.2-py3-none-any.whl.

File metadata

  • Download URL: experta-1.8.2-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.8

File hashes

Hashes for experta-1.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 70d68c1d3c4628bdb63bb5fdef1aaaf60dcf8829d569ae70bdbbdc1a182957e6
MD5 fe185dad4965a35d83a059a1910ad0d3
BLAKE2b-256 0e2aada1ddee7222f15d1b1ffbbf73e523c13b90da3bc96dbceb7a7151ba4f24

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page