Blog

How SmartBots increased the accuracy of intent identification in a chatbot

By October 3, 2019 No Comments

Introduction:

Chatbots have become an integral part of our daily lives. Do you know that machine learning played a key role in achieving such a performance? This article deals with an interesting in-depth concept of chatbot implementation of frameworks like Amazon lex or Google DialogFlow.

I assume the reader to have a basic idea of the steps involved in the implementation of a chatbot by these well-known frameworks. As a first step, we need to identify the intent from the user utterance that plays a key role in giving the right response

Intent Classification:

Lex Approach: Whether in Lex or google DialogFlow or even in Luis, there is a provision to add custom intents for a chatbot. Then, based on the structure of intents, there are proprietary models trained by each of the frameworks. When a user enters a query, these models are actually responsible for identifying intent of that query. Then the predefined response is given back.

Our Approach: As a machine learning company, we at SmartBots have our own custom proprietary models for this task. But in practical situations, when multiple intents have close relationship in terms of words or structure, a model cannot give the proper justified answer with high accuracy.

Consider a doctor appointment bot. We would have intents for booking an appointment and canceling an appointment. The queries would look like the below examples:

  1. Hey, Hi Sara! Can you book an appointment?
  2. Hey, Hi Sara! Can you cancel my appointment?

In each of these queries, there is only one word that helps in identifying the intent of the query, i.e ‘book’ and ‘cancel’ respectively. Typically, an ML algorithm would classify these queries into their respective intents. But it is not practically possible for an ML model to identify the intents accurately every single time, owing to other words in the user input that hinder the model predictions.

To handle such scenarios, we’ve devised an approach with the help of trained NER which I have explained below.

NER: NER (Named Entity Recognizer) or commonly called as keyword extractor, identifies the words and extracts what role they play in the sentence. So we train the NER with proper data to identify whether the sentence has keywords responsible for booking an appointment or canceling an appointment. Then we use NER to identify which keywords are present, then the response is framed accordingly.

Usecase: We built a bot for scheduling an appointment with a doctor. We generated synthetic data to train the intent classifier. Through the regular approach, the bot could identify the intents with 80 percent accuracy. Then, we trained the NER for two separate intents of booking and cancellation of appointments. This new NER was around 85 percent accurate in identifying the intents, but when both models were combined in a hierarchy, the overall accuracy of the bot increased to 95 percent.

Our Conclusion: Based on this exercise, we were able to conclude that adding a level of hierarchy in intent classification by NER improves the performance of the chat-bot.

Leave a Reply

Book A Demo
close slider