A generalised chatbot which can intelligently respond to conversation using named entity recognition (NER), sentiment analysis and an implementation of a decision system for follow up mechanism using a Seq2seq model which uses Bidirectional RNNs and Attention models.
Create an IBM Cloud account. Follow the steps mentioned in the following link- https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/get-started-wdp.html
Using the dialogflow api https://cloud.google.com/dialogflow/docs/quickstart-api
To run the chatbot program you must install the following libraries -
- Install spacy
pip install spacy
- Install tensorflow
pip install tensorflow
- Install dialogflow
pip install dialogflow
- Install textblob
pip install textblob
- Install tqdm
pip install tqdm
- Install tensorlayer
pip install tensorlayer
- Install wikipedia
pip install wikipedia
- Install Watson NLU
pip install ibm_watson
- Install Spacy's English Model
python -m spacy download en_core_web_md
- Install numpy
pip install numpy
- Install pandas
pip install pandas
- Install tensorlayer
pip install tensorlayer
- MediaWiki
- Dialogflow
- IBM Watson NLU (for sentiment analysis)
We have trained our model on three different datasets (SQuAD , Cornell Movie Dialogue Corpus and a Trump Tweets Dataset) to bring about generalisation. They are included in the 'data' folder and are included through an import of the folder.
Note - First make sure that all the files required are saved in the same directory and all the required libraries are installed before running the program. For Windows -
To run it on squad
python model.py squad
To run on cornell_corpus
python model.py cornell_corpus
To run on twitter
python model.py twitter
For Linux (For Python3+ versions) -
To run it on squad
python3 model.py squad
To run on cornell_corpus
python3 model.py cornell_corpus
To run on twitter
python3 model.py twitter
The model can be trained on the user's system or the pretrained weights (.hdf5 files) included in the respective folders can be loaded to view the output.
The results of the chatbot (including the follow up) are shown below -