This project is meant to showcase a small example of an expert system with a forward-chaining inference algorithm.
The knowledge base is stored in a text file.
Here's an example of knowledge base. Each rules and facts follow the following formats.
-| Fact1;
-| Fact2;
Fact1, Fact2 -> Fact3;-
Clone the repository:
git clone https://github.com/mtbelkebir/forward_chaining_expert_system.git
-
Launch the app with a specified knowledge base.
python main.py /path/to/knowledge/base
-
Query the knowledge base by entering the name of the fact to be inferred.
?- MyFact True
The inference engine may display
TrueorFalsedepending on whether the specified goal was reached or not.
Commands are available for certain special actions.
.print: Prints the current knowledge base with all rules and facts..quit: Exists the program..help: Prints the help screen.
-| B;
-| C;
B,D,E -> F;
G,D -> A;
C,F -> A;
B -> X;
X,A -> H;
C -> D;
X,C -> A;
X,B -> D