A basic chatbot can perform the following task:-
1) Answer the sender’s question,
2) Give the sender relevant information,
3) Ask follow-up questions.
4) Continue the conversation in a realistic way.
It contains the following Components :-
1) The Front-End Part :-
- To show the chatting interface.
- Having the user login/logout.
- Having the function like Chat- Summarization.
2) The Chat-Summarizations module :-
That contains the summarizations of the interactions between the user and the Chatbot .
3) The Admin part :-
To add the speech response. The collected data must be added by the admin and Trained).
4) The Data scrapping module :-
Which will scrap the data from the websites/ url links and put into the database. ( Using the python beautiful soup/scrappy module ).
5) The training of the data in the Neural Network :-
So, that if you enter any words or sentences then it will find the exact meaning and display the data on the basics of intents.
WorkFlow and Basic :-
- We will use the Deep Learning approach using the sequence-to-sequence model of Neural Network. In which we are going to map the input sequence to a vector using RNN, then map the vector to the target sequence.
This is having Three main components :-
- Will convert the words into a intermediate hidden state vector. Input sequence :- Are You Free tomorrow ?
- LSTM Network :-
- That will do all the maths like conditional probability of the words by assigning the weights to each word
It will finally output the words with the probability that should be shown.
Output sequence :-
Since we required the flexibility of the length in the output so we are not using the Machine learning which is having the fixed length of the input and output. Hence we are using the sequence2sequence models.
Dataset Selections :-
For sequence-to-sequence models, we need a large number of conversation logs.
Datasets Cleaning or Preprocessing :-
These conversations data is stored in the database where we can extract the data in the form of CSV file, or a JSON format.
We can convert the data into a JSON format or a Dictionary format where the “key” is “My query that we ask” and the “Value” is the Response of the ChatBot response.
We can write a python script for selection of a particular type of the file and do the data cleaning and convert it into the JSON format of “KEY” and “VALUE” pair.
Word Vectors :–
These are all the words that showed up quite frequently in our conversation data file.
- For this we can use the Word2vec Model. This will save the word vectors in a Numpy object. It take cares of the correct grammer.
- We can also use the Seq2Seq model with the Tensorflow. There is a function in Tensorflow’s embedding_mn_seq2seq() function. Where we can find out the loss function, word prediction and number of iterations.
Setting up a Front-end for the Chatbot :-
We can create the basic front end using Angular, and setup a server and a hosting platform. Or we can set up the existing website page/app to connect it.
Deploying Our Trained Model :-
We can deploy the model using Flask server, and the chatbot’s interact with it.
Testing the CHATBOT :-
- Start the server and send the POST request using the CURL in our command prompt. The response will be the response that the bot was trained on.
- If the output is not up to the mark we can do the Hyper-parameters Tuning such as the number of the LSTM units, Choice of optimizer, Number of training iterations or you can choose the right activation function.
Extra Features we can add to this Chat-Bot :-
- We can also make a Voice-to-Text conversion module where use can interact using the voice just like Siri, Cortana, Alexa.
- We can add the Image Recognition Module where a person can be recognized with his Face.
- Also the speech-to-Text module where the Chatbot can interact with audible form just like Jarvis in Ironman.