innovationOUtside / durable_rules_magic

Magic to simplify working with durable.rules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

durable_rules_magic

Binder

Magic to simplify working with durable.rules in educational contexts, initially when working with "subject, predicate, object" triple style reasoning.

Install as:

pip install --upgrade git+https://github.com/innovationOUtside/durable_rules_magic.git

See the demo.ipynb for usage.

Additional Notes

If we define:

from IPython.display import Javascript

class Speech():
    def say(self, txt):
        display(Javascript(f'speechSynthesis.speak(new SpeechSynthesisUtterance("{txt}"))'))

then we can get Python to speak...

For example:

speaker = Speech()
speaker.say('hello')

This means we can hear the reasoning using rules of the form:

   @when_all(Subject('eats', 'worms'))
    def bird(c):
        speaker.say(f'if {c.m.subject} eats worms')
        Set(c, '? : is : bird')
        speaker.say(f'{c.m.subject} is a bird')

which would make the rules both accessible and easier to follow.

Could we perhaps create a decorator to the rules that would provide such spoken annotations?

About

Magic to simplify working with durable.rules

License:MIT License


Languages

Language:Jupyter Notebook 87.6%Language:Python 12.4%