Skip to content

Backward chaining (optimised) rule-based system in Python using lark (Parsing)

Notifications You must be signed in to change notification settings

0auBSQ/Expert_System

Repository files navigation

Expert_System

Backward chaining (optimised) rule-based system

my-image

Starring

Dependencies

Lark : pip install git+https://github.com/lark-parser/lark.git@priority_decay
Ete3 : pip install ete3
Pandas : pip install pandas

Usage

python3 expsys.py [flags] [file]

flags (optional) :

-h : Displays the program usage helper
-m, --modify : Prompts the user after the execution to modify the state of a fact or to add rules
-v, --visual : Shell visualisation of the different rule's parsing tree
-d, --display_trees : Display graphically each rule's parsing tree
-V, --verbose : Additional informations showing the execution steps during the resolution

file (optional):
File with sets of rules, facts and queries, if not set the program will promps the user and read on STDIN.

File format

## Rules

# Imply
A | (D ^ !E) => B + C

# If and only if (Double Imply)
A <=> !F

## Queries

# Display the following facts' states after the execution
?ABC

# Remove queries (useful while using the modify flag)
?!A!B

## Facts

# Set TRUE
=AB

# Set FALSE (all facts are originally "FALSE_UNSET", "FALSE_UNSET" facts are defined using the rules during the execution, "FALSE" facts are fixed)
=!C!D

# Set UNDEFINED (State for ambiguous facts)
=~E~F

# Unset facts (useful while using the modify flag)
=$B$C$D$E$F

About

Backward chaining (optimised) rule-based system in Python using lark (Parsing)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages