Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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

CHANGELOG

1.9.4

  • Resolved #10. Corner case in DepthStrategy in which the first activation of the agenda didn’t get removed.

1.9.3

  • Resolved #11 that was introduced with #7, that caused the same behavior under different conditions.

1.9.2

  • Resolved #7. In some situations last activation was removed right after entering the agenda.

1.9.1

  • Resolved #3. Rules should not be called with already retracted facts.

1.9.0

  • Drop Python 3.4 support.

  • Use setup.cfg to save all package metadata.

1.8.0-1.8.2

  • Rebranded to Experta.

1.7.0

  • Implemented the template system.

  • Replaced warnings by watchers messages.

  • Fixed freeze() with frozen objects.

  • Fixed unfreeze() with unfrozen objects.

  • Parametrized DefFacts via reset() kwargs.

1.6.0

  • Improved overall performance.

1.5.0

  • Added Python version 3.7 to tox.ini.

  • Monkey and bananas example.

  • Fixed bug, numeric index args gets repeated in a weird way introduced in 1.4.0.

  • Pass only the defined args in absence of kwargs.

1.4.0

  • Order integer facts keys after making a copy.

  • as_dict method for Fact.

  • freeze and unfreeze method documentation.

  • unfreeze method in pyknow.utils.

  • Zebra example from Clips.

1.3.0

  • pyknow.operator module.

  • Nested matching.

  • Added Talk ‘Sistemas Expertos en Python con PyKnow - PyConES 2017’ to docs folder.

1.2.0

  • Freeze fact values as the default behavior to address Issue #9.

  • Added pyknow.utils.anyof to mitigate Issue #7.

  • Raise RuntimeError if a fact value is modified after declare().

  • Added MATCH and AS objects.

1.1.1

  • Removing the borg optimization for P field constraints.

  • Use the hash of the check in the sorting of the nodes to always generate the same alpha part of the network.

1.1.0

  • Allow any kind of callable in Predicate Field Constraints (P()).

1.0.1

  • DNF of OR clause inside AND or Rule was implemented wrong.

1.0.0

  • RETE matching algorithm.

  • Better Rule decorator system.

  • Facts are dictionaries.

  • Documentation.

<1.0.0

  • Unestable API.

  • Wrong matching algorithm.

  • Bad performance

  • PLEASE DON’T USE THIS.

Release files for expert-ceylon 2.0.0a2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for expert-ceylon 2.0.0a2
File Size Uploaded
expert_ceylon-2.0.0a2.tar.gz 29.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for expert-ceylon 2.0.0a2
File Interpreter ABI Platform
expert_ceylon-2.0.0a2-py3-none-any.whl Python 3 none any Details

Total release size: 65.8 kB

Release files / expert_ceylon-2.0.0a2.tar.gz

Download URL expert_ceylon-2.0.0a2.tar.gz
Size 29.5 kB
Tags Source
SHA-256 checksum
How to use checksums
040956a8ec17e6406df67311a35f6a8a296a2e709fe8c208de3a645532895b9a
BLAKE2b-256 checksum
How to use checksums
99234bd0546511a63fc124f3f89921a765fbaaffa945c51772b719b3df3a56f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / expert_ceylon-2.0.0a2-py3-none-any.whl

Download URL expert_ceylon-2.0.0a2-py3-none-any.whl
Size 36.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3794efb293895ead1faf9097fd095493cc4365f91ae64e2b33c18a4f9917d43
BLAKE2b-256 checksum
How to use checksums
bfd976e0f795ac3d4618ee88726bb9989b022b5ab991d2cc6149a3fb435068c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

2.0.0a2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page