Kore.ai virtual assistant platform enables one to build a conversational AI virtual assistant. Conversational AI is all about enabling a machine to have natural conversations with users. The key for a conversational bot to understand human interactions lies in its ability to identify the intention of the user (Intent Detection), extract useful information from their utterance (Entity Extraction), and map them to relevant actions or tasks (Dialog Task execution). The crucial term here is understanding the natural language.
NLP (Natural Language Processing) is the science of deducing the intention and related information from natural conversations. The conversation flow in Kore.ai virtual assistants passes through various NLU engines and conversation engines before deciding upon action and response.
This document aims at providing an overview of the NLP flow within a Kore.ai virtual assistant and how you, as a developer, can leverage its features for an efficient and accurate bot response thus improving the user experience.
NLP Approach
The Kore.ai Bots platform employs a multi-pronged approach to natural language, which combines the following three models for optimal outcomes:
- Fundamental Meaning: A computational linguistics approach that is built on ChatScript. The model analyzes the structure of a user’s utterance to identify each word by meaning, position, conjugation, capitalization, plurality, and other factors.
- Custom Machine Learning (ML): Kore.ai uses state-of-the-art NLP algorithms and models for machine learning.
- Ontology-based Knowledge Graph Engine (KG): Kore.ai Knowledge Graph helps you turn your static FAQ text into an intelligent and personalized conversational experience.
With its three-fold approach, the Kore.ai Bots platform enables you to accelerate the NLU performance of the virtual assistant and achieve optimal NLU accuracy with relatively less training data. It automatically enables the NLP capabilities to all built-in and custom bots, and powers the way chatbots communicate, understand, and respond to a user request.
Kore.ai NLP Building Blocks
When the Kore.ai Virtual Assistant receives a user utterance it is processed to identify the user intent, extract any additional information and then answer the user via a task execution. NLP is mostly concerned with the first two – intent detection and entity extraction.
Steps in a conversation flow:
- The user utterance goes through a series of NLU engines for entity extraction and intent detection. The various NLU engines provided by the Kore.ai platform are as follows:
- Fundamental Meaning Engine which breaks up the utterances based on the grammar constructs;
- Machine Learning Engine which classifies individual words in the utterance based on an example-based auto-learning training process;
- Knowledge Collection Engine which mostly deals with FAQ type user queries, it can also be configured to trigger tasks in response to the user query;
- Traits Engine which is a multiclass classifier and can identify multiple categories in user utterances thus aiding in refining user intent detection;
- Small Talk Engine for adding a human flavor to the conversations;
- Ranking and Resolver to score the results from the above engines and rank them according to the set business rules.
- You can extend the above out-of-the-box NLU functionality to use your own NLU engine. You can install the Bot Kit SDK and easily integrate the virtual assistant with any 3rd party NLP engines. The output from the 3rd party NLP engine complements the outputs from the Kore.ai NLU engines thus adding to the efficiency and accuracy of the engine.
- The winning intent along with the entities extracted then passes through the conversation engine for the actual task execution. This engine maintains the state or context of the conversation with information like user details, the previous intents requested by the user, and any other information as tagged by the business rules which would aid in providing a near-human conversation experience. The conversation engine uses this state information along with the following conditions to accept or reject the intent identified by the NLU engines
- Pre-conditions – if an intent has a set of predefined conditions configured and if any of these conditions are not satisfied then the winning intent is rejected. For example, bill payment intent should have the payee details available.
- Negative patterns – to capture the presence of a pattern that should not identify a particular intent. For example “I lost my card, how do I apply for a new card” should, instead of triggering “Apply Card” intent, attempt to disable the current card and report fraudulent activity due to the presence of the phrase “lost my card”
- Event handling – events defined for a welcome message, sentiment analysis, etc
- Other conditions like Interruption settings (to handle situations where another intent is identified during the course of an ongoing task) or Sentiment Analysis settings (user sounds angry and hence should be transferred to an agent) also are crucial on the action to be taken.
- A response is generated and presented to the user based on the channel of interaction. The response could be a success message, information as requested by the user, or prompt for missing information.
NLP Training
In the previous section, we have seen the NLP process of the Kore.ai virtual assistant, but it needs some training on your part to ensure that the process proceeds as per your requirements. So, how to train a fully functional bot to achieve the best results? How to make maximum use of the above features?
We will see some basic guidelines in NLP training in this section, before going into the details of each of the NLU engines.
Scoping
The first step in NLP training would be to define the scope of the bot, narrowing down the problem the bot will need to solve helps in configuring the various training nuances. This involves brainstorming sessions with various stakeholders like SMEs/BAs, Conversation Experience Designers, Bot Developers, NLP Analysts/Data Engineers, NLP Trainers, and Testers.
Following are the basic guidelines suggested while scoping the bot:
- Start with a problem to solve – get a clear idea of what the bot is supposed to accomplish. Talk to the business analyst and the bot developers to understand the requirements and the actual functionality of the bot.
- Create a list of Intents for the use cases – this would streamline the entire process
- For each intent, identify the key results that the bot is aiming to accomplish
- The focus should be on the needs of the user and not the platform requirements
- Detail out example conversations – both utterances and responses
- What is the ideal Person in the room result
- Think through edge cases, follow-ups, clarifying questions
- You can leverage the Storyboard feature of the platform for this. If it has not been already used for the bot development phase, you can use it now
- Ask what a person might ask as a part of achieving the actions – these would be the alternate utterances for every intent. Try to include idiomatic and slang usage also.
Which Engine?
We have seen above that the Kore.ai platform offers three main engines for NLU
- Machine Learning (ML)
- Fundamental Meaning (FM)
- Knowledge Collection (KG)
Which engine to use when? Each of these engines has settings and configurations. These are dealt with in detail elsewhere (see here for details). Here we will list out broad guidelines as to which engine to use when.
Machine Learning Engine
ML is the recommended engine for training a bot. The reason for this is its flexibility and auto-learn feature. Given a few examples, the engine learns and is capable of understanding similar new utterances. And the training utterances need not be full sentences, ML can learn from phrases too.
If you have a large corpus for each intent that you are planning to implement, then go for Machine Learning. Even if you don’t have a corpus it would be a good idea to develop one. In the long run, it is better to spend time building a large corpus and use ML rather than going for the other less time-consuming, easier options.
Definition of large corpus could differ depending on the intents. For example, if the intents are very different from each other without any commonality and can be understood using their sample data like “Get Balance” and “Transfer Funds“, then a corpus of 200-300 for each intent is sufficient. However, if intents are closer to each other like Transfer funds and Pay bill (they usually start with a very similar utterance “I want to pay….”), then the corpus should be in 1000s.
Similarly, if you are planning to use Deep Neural Networks, you need a higher number of samples for better predictions of both True Positives and True Negatives, as these networks are data-hungry.
Knowledge Collection Engine
If your intents are more query-like in nature than transactional tasks or if the content is in documents and you want the bot to answer user queries from documents, then go for Knowledge Collection. Knowledge Collection can also be used to trigger dialog tasks in response to user queries thus works as a double-edged sword.
If you have a lot of Intents but do not have time to prepare alternate utterances, but you can manually annotate some important terms, go for Knowledge Collection. But it is advisable to spend some time in building a corpus and going for ML since annotation in KG works in a similar way to ML’s auto-learning process.
Fundamental Meaning Engine
If you have cases where users could use idiomatic sentences or command-like sentences or if you are not too strict and can live with some false positives then go for FM engine.