/Knowledge-Based-QA-System-with-Python-and-Prolog

This project is a simple implementation of a knowledge-based system. It is a simple ChatBot. There is a prolog file that defines the knowledge base. The questions are handled with python. The key idea is mapping different questions for the same answer. The simplest way is finding keywords in the question. Using the keywords, a query is performed on the prolog knowledge base. Then the query result is shown with some prefix and suffix as the answer.

Primary LanguagePythonMIT LicenseMIT

Knowledge Based QA System with Python and Prolog python prolog

A knowledge-based system (KBS) is a form of artificial intelligence (AI) that aims to capture the knowledge of human experts to support decision-making. Examples of knowledge-based systems include expert systems, which are so called because of their reliance on human expertise.

This project is a simple implementation of a knowledge-based system. It is a simple ChatBot. There is a prolog file that defines the knowledge base. The questions are handled with python. The key idea is mapping different questions for the same answer. The simplest way is finding keywords in the question. Using the keywords, a query is performed on the prolog knowledge base. Then the query result is shown with some prefix and suffix as the answer.

These types of chatbots can handle frequently asked questions in a system. For example, this program can be an extension of a university website that can handle general queries about the university.

Build linux


Install prolog

$ sudo apt install swi-prolog

To build and run the program, open terminal and change directory to the program directory. Then execute the following commands.

$ python -m vevn venv
$ souce venv/bin/activate
$ pip install -r requirements.txt
$ python main.py

This program can be built and run on windows too. First install prolog, pip. Then run the commands in the commands in the cmd terminal to build and run the program.

To create executable, run

$ pyinstaller main.py

Run the executable

./dist/main/main


LICENSE License: MIT


Copyright © 2020, Kamrul Hasan. Released under the MIT License. See more