Let the Chatbots talk for us....

What is a chatbot ?

I guess everyone knows what a Chatbot is. A Chatbot is a chatting application where a human-like machine chats with us. When I say human-like, some of you might wonder if I am talking about a humanoid robot which can chat on whatsapp or fb. Not really, it's just a simple software program which takes an input and gives an output. Inputs will be questions or things that we will ask to the machine and the outputs are the replies from the software. And those outputs will be more human-like and human-understandable.

Some examples are Natasha on Hike, Google assistant by Google, Siri by Apple, Cortana by Microsoft etc. The last 3 examples have more capabilities than a normal Chatbot. They are called Virtual Personal Assistants. They can perform certain tasks on commands, remind us certain things which are on calender, wake us up every day and can do a lot more.
Image source: Internet


Exploring the myth 

Chatbots or personal assistants are not more than humans till now. They are programmatically created by humans. They can answer the questions which they know. They don't posses any thinking capabilities. Not all, but 90% now. 10% is for neural network based Chatbots. As neural networks are simulated human brain, I can not tell that it can't think. Most of the Chatbots are NLP (Natural Language Processing) based.
In this article we will be talking about NLP based Chatbots. If we closely look into human conversation, we can see a pattern in it. You might be wondering what :-) . Every conversation starts with a greeting or a question.What we have to crack is to find out what the question is about. The reason which was the building factor for that question. Basically most questions will be about the noun phrases in that question. NLP is the one and only way to crack this kind of trivial situation. Today we are going to see how to make an NLP based chatbot.


Neural-Bot is an open source Chatbot created by me 😎. You can find out the github link here . It's purely a NLP based Chatbot. You might be thinking why I named it as Neural-bot. It's simply because of it's architecture. If you look into the diagram you will understand what I mean. Neural-Bot has a Neural network inspired architecture. Our Neural-Bot can have knowledge on multiple domains. 

Each neuron will be have knowledge on different domain. For example one neuron will be having knowledge of different places, other will be having knowledge of different flowers etc. Now you might be thinking why we need different neurons? Can we put everything in one neuron? Till now I didn't tell you the underlying logic of an NLP based Chatbot. It's basically string comparison. For example, the question asked to a Chatbot can be "What is a nose?". If we haven't stored the answer for nose in our data structure for nose keyword and if there is a question like "What is a rose" in our data structure our Chatbot can give wrong answer. Instead if there was a question and answer for nose in our data structure then it should give right answer. In such situations our Chatbot fails. That is the reason why I have separated each domains on each neurons. Take a look into sample data structure of a single neuron below.

Whatever user is asking to Chatbot we are trying to extract the keyword from it (mostly noun phrases) and if the keyword is there in the data structure then it will enter that dataset. Dataset is stored as a list so we will simply iterate through all the odd indexes in that list and compare the questions. Whenever an exact match is found it will return that answer. Answer will be located on the last compared odd index plus one position.

Each neuron will return a response and confidence value. Confidence value is calculated based on string comparison. Based on the confidence values of all neurons the neuron in first layer decides which response should be given back to the user. Response with higher confidence value is always given back to the user. This is how Neural-Bot works.

You can find more on my github repository



  1. I’m inspired, I should say. Seldom do I come across a blog that’s both educative and thrilling, and genuinely, you have hit the nail at the pinnacle. The problem is an trouble that no longer sufficient folks are speaking intelligently about. Now i am very happy I stumbled across this in tech the direction of my hunt for some thing regarding this.

  2. This is such a great resource that you are providing and you give it away for free. This is really a nice and informative, containing all information and also has a great impact on the new technology.
    Herbie is the foremost Chatbot Companies in UAE. We are different from Chatbot Development Companies. We are specialized in AI Conversational Chatbots and Virtual Assistant Chatbot. Herbie is most intelligent Virtual Assistant ever developed by AI Chatbot Companies


Post a Comment

Popular Posts