Lab 1
Lab 1
systems
“ lab1”
Expert Systems
How To Implement an expert system
⮚ CLIPS
⮚ Python
▪ a rule‑based programming language
Written in C
▪ f = Fact(a=1, b=2)
▪ In contrast to dict, you can create a Fact without keys
(only values), and Fact will create a numeric index for
your values.
Facts
▪ f2 = Fact('x','y','z')
f3 = Fact('x','y','z',a=1,b=2)
▪ You can subclass Fact to express different kinds of data
or extend it with your custom functionality.
class Status(Fact):
"""The system status."""
pass
f1 = Alert('red‘, ‘noise’)
f2 = Status('critical')
▪ In Experta a rule is a callable, decorated with Rule.
▪ @Rule
"""
print("Meow!")
Rules