Movie Recommendation Slack chatbot using IBM Watson, nltk, pandas and scikit-learn
Table of Contents
The chatbot uses a recommendation engine to suggest similar movies with their IMDB links and posters. In addition, it also provides information about the following properties of the movie input by the user:
- movie genre
- movie plot
- revenue
- budget
- IMDB rating
- IMDB site link
To give a recommendation of similar movies, Cosine Similarity and TFID vectorizer were used. Slack API was used to provide a Front End for the chatbot. IBM Watson was used to link the Python code for Natural Language Processing with the front end hosted on Slack API. Libraries like nltk, sklearn, pandas and nlp were used to perform Natural Language Processing and cater to user queries and responses. Since the chatbot is hosted on Slack, multiple users can communicate with it at the same time.
Find more screenshots, please visit the screenshots folder Or click here
This file will walk you through the steps to setup your bot. Download the entire folder and the follow the steps below.
Step 1: Create Slack Bot user
Please follows the instructions in the link below to create a Slack App.
Step 2: Create a IBM Watson account and Upload the bot.json workspace Please follows the instructions in the link below to create a Slack App.
Step 3: Install required packages 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
Step 4: Update the config files with the Slack and Watson API details Please make sure that you modified the API details both for Slack and Watson in the config.py file
Step 5: Download data from source and perform Data Preparation 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.
I have uploaded the sample of the data here (metadata_prep_sample.csv).
Step 6: Create "onetime.txt" file 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.
Step 7: Initiate Bot Navigate to the folder where the main python script exists and run the code below.
python main.py
- Github: https://github.com/kaushikjadhav01
- Medium: https://medium.com/@kaushikjadhav01
- LinkedIn: https://www.linkedin.com/in/kaushikjadhav01/
- Portfolio: http://kajadhav.me/
- Linked In: https://www.linkedin.com/in/kajadhav/
- Dev.to: https://dev.to/kaushikjadhav01
- Codesignal: https://app.codesignal.com/profile/kaushik_j_vtc
- Google Scholar: https://scholar.google.com/citations?user=iRYcFi0AAAAJ
- Daily.dev: https://app.daily.dev/kaushikjadhav01
- Google devs: https://developers.google.com/profile/u/kaushikjadhav01
- Stack Overflow: https://stackoverflow.com/users/21890981/kaushik-jadhav