This is a part of the CS F407 Artificial Intelligence Course at BITS Pilani Hyderabad Campus. In this assignment, a messenger bot is created which can provide intelligent dialog conversations with the user, similar to ELIZA or ALICE.
- AIML is used for the core of the chatbot.
- The messenger bot uses a knowledge base with multiple random responses exchanged between the user and the bot.
- The bot is able to give replies to multiple interactions and stores the conversations in a database. These persistent copies of the interactions can be retrieved the next time user chats with the bot.
- The bot interacts with web services and recommends students healthy food options by web scraping.
- The bot can tell the current weather by interacting with a web API.
- the whole project is based on keyword matching and intent recognition.
Artificial Intelligence Markup Language (AIML) is used for creating the core of the chatbot. The frontend is developed using Android and backend using Python. The back end is in Python and front end is created using Android. The app has been tested locally on Android Studio and not on an Android Phone.
The database information is stored in MySQL database on a local machine. For viewing and updating databases, contains the appropriate code.
A database named user_chats should be created in the mysql system first. 2 tables named chats and faculty are used for persistent storage.
The chats table stores the timestamp,userid, bot query and bot response in that order. Basic commands required to create/navigate through the db have been provided in a seperate file "mysql.txt"
Before starting ensure that you have mysql on your machine.
- Create a database named user_chats
- Create table namely chats
- Change the username and the password in the python files app & conversation
Make sure to install the dependecies
pip install AIML
pip install beautifulsoup4
pip install urllib2
make sure to update the python time library, there is a common issue while using with the AIML library FIX Available here: https://stackoverflow.com/questions/58569361/attributeerror-module-time-has-no-attribute-clock-in-python-3-8
The backend server has to be run first on port 8000.
The backend server can be run simply via
$ python app.py
(Python v3.9 was used for development)
The front end Android part can be run in Android Studio.
- Set up Android Studio,and install an emulator for testing/running the app.
- Open the MyApplication folder in Android Studio.
- Press the Play button to run the app.
- This code was run on Pixel 3A device.