7Natural Language Processing

How Does Oracle Virtual Assistant's Natural Language Matching Work?

The Natural Language Processing match engine used by Oracle Virtual Assistant works by recognizing the intent behind a user's expression, and then displaying a response.

User expressions are matched to relevant responses using intents. You create an intent in the Oracle Virtual Assistant user interface by defining a set of sentences, usually in the form of questions, which the system can interpret as a representation of the meaning or intent underlying a user's expression.

The questions defined for an intent should all have the same underlying meaning, even if the expressions themselves do not seem similar. For example, the following questions could be said to be related by the intent of the user wishing to know their bank balance:

  • Where can I view my current balance?

  • How much money is in my account?

  • How much cash do I have?

To see how Oracle Virtual Assistant determines the meaning of an expression, let’s take the first question Where can I view my current balance? as an example.

As shown in the following figure, Oracle Virtual Assistant uses language-specific dictionaries and grammars to analyze the question. Each word is first analyzed individually, for example, the word is classified as a noun, verb, adjective, and so on. Next, the question is analyzed at the sentence level to determine the word’s role within the sentence, for example, is the word the subject or object of the sentence. From these analyses, Oracle Virtual Assistant derives a meaning representation for the question which it stores.

Analysis of a user expression to determine its meaning

The system creates the same sort of meaning representations for every question that you associate with an intent, and stores them for use in the matching process. When the user addresses a question to the virtual assistant, the match engine performs the same type of analysis to create a meaning representation for the user expression, and then tries to match the generated meaning representation to those stored for each intent.

For example, the following figure shows how the user expression Where can I check my cash? is matched to the intent Where can I view my current balance? The application generates a semantic representation of the most meaningful words and phrases in the expression. The resulting meaning representation is compared to the meaning representations of existing intents, using semantic relations and hierarchies to find the best match.

Matching a user expression to an intent question

When the stored question or expression that matches best is found, then the response defined in the related intent is retrieved and shown to the user. Each match is assigned a score between 0 and 100, where 100 represents a perfect score. You can use the scores to assess the quality of matches.

For detailed information about the way in which the virtual assistant analyzes words and sentences, see How Does Oracle Virtual Assistant Analyze Natural Language?.

Why are Meaning Representations Better for Identifying Intention than Keywords?

It's difficult to make a computer understand that many expressions that have the same meaning can be phrased in many different ways. It's equally difficult to make a computer understand that expressions that contain many of the same words actually mean something entirely different.

For example, check and cash can be used in ways which would result in very different answers:

  • Where can I check my cash? (retrieving my bank balance)

  • Has my check been cashed? (state of a transaction)

  • Will the bank cash my check? (rules for cashing checks)

Many approaches use different variations of keyword matching in order to recognize intent. Keyword matching involves finding the important content bearing words and discarding all other information in order to match a user's expression to content. The example questions above show why recognizing keywords, without recognizing the roles they play in a sentence, is not enough to understand the underlying intent. In the three example sentences, the expressions contain the same content words but mean entirely different things and require entirely different responses from the virtual assistant.

With Oracle Virtual Assistant's natural language processing, user expressions are analyzed both grammatically and semantically and a context related response is returned to the user.

Meaning Representations and Intent Questions

The match engine uses systems of rules to allow user queries to match with the questions stored in Oracle Virtual Assistant, which are grouped under an intent. Matching involves checking whether some meaning overlap exists between the user query and the questions that are stored in the virtual assistant. Unlike a search engine, the virtual assistant focuses only on comparing the expression to the match questions, it does not look at the intent response to provide an answer to the user.

The match engine uses the semantic relations between the meanings of words to match user expressions with intents. In addition, two other systems of rules are used: grammar rules and translation rules. The combination of these meaning relations and rules trigger matching between related questions whose form might seem to have no relation to each other. This is the reason why Where can I check my cash? might match Where can I view my current balance?

A translation rule might be How much do I need to pay for X? maps to How much does X cost? This rule means that both these sentence forms are treated equivalently by the natural language processing match engine. When expressions generate the same semantic representation, you will find that you can't add the question to the intent. This is so that questions are not proliferated unnecessarily and your intent is easier to manage.

The natural language processing match engine relies on general rules that are deliberately selected to cover the core of the language. However, not all question variants can be covered by the existing rules so you can create additional questions for an intent to broaden the chances of user queries matching.