Chatbot architecture

A chatbot is nothing but a computer program that can chat with a user and perform certain levels of tasks on behalf of the user. Chatbots seem to have a direct connection between the user's problem and the solution. The main aspects of chatbots are as follows:

  • Simple chatbot: Regarding this type of chatbot, the user will type some text, mostly in the form of questions, and the bot will respond with an appropriate reply in the form of text.
  • Conversational chatbot: This type of chatbot is aware of the context of the conversation and maintains the state. The response to user text is in the form of a conversation according to the user.
  • AI chatbot: This type of chatbot learns from the training data provided to it, which is prepared from many different scenarios or from a long log of conversations from the past.

The main aspect of a chatbot is to generate a proper or appropriate response to the user's text using some predefined library or database, or using machine learning models to generate a response. A machine learning algorithm allows training bots with lots of examples of data or conversations to pick a pattern. It uses intent classification and entities to generate a response. To find the intents and entities, it uses the concept of Natural Language Understanding (NLU):

Using machine learning for chatbots requires a great understanding of machine learning algorithms, which is out of the scope of this book.

We will be looking into an option where machine learning is not involved, and such a model is called a retrieval-based model, where the response is generated from some predefined logic and context. It is easy to build and reliable, but not 100% accurate in response generation. It is widely used, and several APIs and algorithms are available for such models. It generates a response on the basis of an if...else condition, which is known as pattern base response generation:

It relies on Artificial Intelligence Markup Language (AIML) to record patterns and responses. This will be discussed in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset