CLIPS Python bindings
Initially developed at NASA’s Johnson Space Center, CLIPS is a rule-based programming language useful for creating expert and production systems where a heuristic solution is easier to implement and maintain than an imperative one. CLIPS is designed to facilitate the development of software to model human knowledge or expertise.
CLIPSPy brings CLIPS capabilities within the Python ecosystem.
On Linux, CLIPSPy is packaged for x86_64 architectures as a wheel according to PEP-513 guidelines. Most of the distributions should be supported.
$ [sudo] pip install clipspy
CLIPSPy comes as a wheel for most of the Python versions and architectures.
> pip install clipspy
Building from sources
The provided Makefile takes care of retrieving the CLIPS source code and compiling the Python bindings together with it.
$ make $ sudo make install
Please check the documentation for more information regarding building CLIPSPy from sources.
from clips import Environment, Symbol environment = Environment() # load constructs into the environment environment.load('constructs.clp') # assert a fact as string environment.assert_string('(a-fact)') # retrieve a fact template template = environment.find_template('a-fact') # create a new fact from the template fact = template.new_fact() # implied (ordered) facts are accessed as lists fact.append(42) fact.extend(("foo", "bar")) # assert the fact within the environment fact.assertit() # retrieve another fact template template = environment.find_template('another-fact') fact = template.new_fact() # template (unordered) facts are accessed as dictionaries fact["slot-name"] = Symbol("foo") fact.assertit() # execute the activations in the agenda environment.run()