Chat-bots: How to create?

Srishtee Kriti
3 min readAug 3, 2020

With the increase of use of technology and internet we use chatbot or “conversational agents” nearly everywhere.From websites for assistance to our smart phones they are present in nearly everything. They know everything what to answer how to react to a given situation and what questions to ask.

In earlier days chatbots run with pre-programmed data. But now with the help of artificial intelligence and natural language processing they give us an intelligent answer rather than a programmed one.

Benefits of using Chatbots

These bots are a benefit for the company where the software is deployed and to the consumers also as they tend to give perfect answers to their queries.

For customers it works 24/7, it gives instant reply with relevant information sometimes even with pictures and videos. This helps the customer to gain insights of the particular area for which they are using the chatbot.

For producers it gives customer satisfaction and it is also pocket friendly. They have to pay just once for creating a chatbot and then no additional costs is required.

Working of the Chatbot

Natural language processing (NLP)is the steeping stone for chatbot. With the help of NLP the machine will actually understand the context of the sentence.

First and foremost thing is removing stop words like a,the etc. from the dataset. Then the words should be in the root word format but this is not necessary. NLTK library contains functions from these one can easily remove the irrelevant words.But all these things depend what kind of model you are working with,

Now before understanding the context one have to convert the words into machine readable format or encoding.These encoding are vectors.There are various types of encoding ranging from simple One-Hot encoding to context aware encoding like ELMo. One-Hot encoding will only take care if the word is present in the sentence or not this means hotel and resturant will have different encodings and there dot product will be zero whereas in ELMo encodings will be overlapping for the given words.

Now when the words are converted to desirable vectors now is the time to design a model which can work as chatbot. There are various pretrained models which can be used by fine tuning the parameters with our own datasets or we can design one. Some pretrained models which is trained one huge datasets are BERT and GPT-2. They are designed using encoder and decoder of transformer (attention is all you need) respectively. One can also use USE or universal sentence encoder.

For training your own model Keras and tensorflow can be used. Chatterbot library is also for training chatbots.

In the End

Chatbots are very easy and fun to make. While making sometimes they gave so irrelevant answers that one cannot sit without laughing. With the help of python libraries this is an incrediblyeasy task.

--

--