This file will walk you through the steps to setup your bot. Download the entire folder and the follow the steps below. When you download the folder, if it says "Movie_Bot-master", please rename it to "Movie_Bot" to avoid any errors.
Please follows the instructions in the link below to create a Slack App.
https://github.com/Sundar0989/Movie_Bot/blob/master/slack/Create_slack_app.ipynb
Please follows the instructions in the link below to create a Slack App.
Install the required packages listed in the requirements.txt file. To install the required packages, please use the code below. I might have missed some packages to include in the requirements.txt file. When you initiate the bot, it might fail that a particular module does not exist. Please install it and then initiate bot again, which will fix the issue.
pip3 install -r requirements.txt
It would be recommended to use Python 3.5.x or 3.6.x version for this project.
Please make sure that you modified the API details both for Slack and Watson in the config.py file
The data for this example is downloaded from the location below,
https://www.kaggle.com/rounakbanik/movie-recommender-systems/data
Name of the dataset - movies_metadata.csv
Since the dataset size is greater than 25MB, I provided only a snippet here in the data folder. However, the exercise is built on the entire dataset obtained from the source. Please download the data from Kaggle and use it for your practice.
"metadata_prep.csv" will be created after you run the data preparation code which will be later used in nlp models to train the movie recommendation system. The data preparation code is provided below.
https://github.com/Sundar0989/Movie_Bot/blob/master/data/Data_Preparation.ipynb
I have uploaded the sample of the data here (metadata_prep_sample.csv).
Navigate to the folder where the main.py file resides and execute the code below.
python3 nlp/nlp_solutions/onetime_run_file.py
This will create the "onetime.txt" file automatically. If you need to rename this file, update the name in "config.py" file.
Navigate to the folder where the main python script exists and run the code below.
python3 main.py
The Movie bot framework used here is a closed domain chatbot. The entire framework design is shown below.
Users can interact with Kelly via Slack. Once the user post a question via the interface, the question is passed to the backend system for analysis
All the natural language processing happens in step 2.
After the NLP processing is completed, we have three outputs from it
- Intents - What the user is trying to ask or query?
- Entities - What is the exact field or column they are looking for?
- Dialog/Interaction - Provide the appropriate request/response for the user question.
Currently, the data resides in a excel file. However, you can add multiple databases/excel files if needed, to access different sources. Based on the results from step 3, the appropriate database/excel file is queried and the results are returned.
The results obtained from the backend is posted to user via Slack
The interactions between the users are logged and stored in a flatfile format in a log file. Also, if the bot is not able to identify the user questions it will add those questions to a followup file.