Developing Ai Chatbots

What is a chatbot?

A Chatbot is a computer program that conducts conversations with its users through text or auditory methods. This can be done on a website or a messaging app like Slack, WhatsApp, Skype etc.

Development of chatbots dates back to 1966 when Joseph Weizenbaum built ‘Eliza’ that used substitution and pattern matching to simulate conversation, where words entered by a user were paired to a list of possible responses to find a suitable output.

Over the recent decades chatbot developers have built on this model to create more interactive chatbots. Some recently developed commercial chatbots include Alexa by Amazon, Cortana by Microsoft and Google Now by Google.

Models for developing Chatbots

The two main approaches to developing a self-learning chatbot are:

  • Retrieval-based models
  • Generative models.

The Retrieval- based chatbots have a list of predefined responses from which they rank the best output based on a user’s input. The list may be created manually or based on previous conversations.

The generative based chatbots are trained using a large number of previous conversations upon which a response is generated to the user. They don’t have a predefined list of responses. Thus, retrieval-based chatbots are based on Natural Language processing while generative models are based on deep learning (sequence to sequence neural network).

What are some applications of chatbots?

  • Chatbots provide better customer support since less time is used as compared to connecting a customer to a human assistant.
  • Chatbots help customers find exact solutions to the problems they are querying for within a limited time.
  • Chatbots help businesses process and gain useful information from a large group of clients.
  • Chatbots connect clients to their finances.

Non-Technical challenges of Chatbots

  • Different users have different ways of typing messages. This makes it difficult for the bot to know when to reply to a users’ text.
  • User language keeps on changing with time thus the need to frequently update the code in order to accommodate the newly created vocabulary.
  • Human beings write messages based on their emotional status. It’s therefore difficult for a bot to determine the emotions of a user to respond appropriately.

Some Chatbot Frameworks in Python

ChatterBot library in Python

ChatterBot uses machine learning algorithms to generate a variety of responses to user inputs. It allows the bot to be trained in various languages through its design. The ChatterBot receives user input from the console, API etc. The input statement is processed by the logical adapters which select the statement that closely matches the input statement and return a known response to the selected match and a confidence value based on the matching. The response with the highest confidence value from the logic adapter is returned as the response to the user input.


  1. About ChatterBot
  1. How does a chatbot learn on its own?

Author: Isaac K. Mutinda, This email address is being protected from spambots. You need JavaScript enabled to view it.