NLP tunnels

How to detect several intentions in the same sentence

➜ Discover Botnation and launch your chatbot easily!

Definition of a Tunnel:
This is a priority AI rule that triggers a search in another context. Optionally, an intermediate sequence can be started.

This intermediate sequence can be used, among other things, to store data in passing in a variable without displaying anything in the chatbot.

Definition of a Variable:
This is data that the chatbot will store in its memory. A variable is defined by its name and by its value.

Example: The Variable with the name “property_type” can take the value

It is a complex logic to master, but it is a very powerful tool. It will indeed make it possible to detect several intents in the same sentence. The Tunnel in the default context detects a first Intent and then searches the AI rules of another context for the second Intent.

It is also possible to put Tunnels in the secondary context and therefore to detect a third Intent. In theory, using Cascading Tunnels you can detect as many intentions as you want in the same sentence. But from a practical point of view, it is better to limit yourself to three intentions.

The best way to understand how it works is to study a practical case.

Exemple:

Also in our London real estate chatbot, we want to detect, in natural language, the type of transaction, the type of property and the district concerned in order to be able to launch a search in an ad database.

It is therefore necessary, not only for the chatbot to understand a sentence such as “I am looking for an apartment for sale in Camden” but also to translate this information into data that can be understood by the search engine.

Cascading tunnels and their intermediate sequences will be able to solve this problem.

The general idea is to detect each intent one after the other.

We will need 3 contexts: the default context in which we will detect the “Transaction type” intention, a “Asset type” context to detect this intention and finally a “District” Context for this intention.

Default context

We create a first Tunnel “Purchase” with the keywords corresponding to this intention and which will launch a search in the Context “Type of asset”.

And we use the intermediate sequence to store the information by assigning the value “purchase” to the variable “transaction_type”.

We then create a “Sale” Tunnel with the corresponding keywords and which will also launch a search in the “Type of asset” Context.

And we use the intermediate sequence to store the information by assigning, this time, the value “sale” to the variable “transaction_type”.

We can therefore see that we can have 2 different tunnels which refer to the same context, but since their intermediate sequences and their keywords are different, they detect two different intentions.

The chatbot can now therefore make the difference between “I am looking to sell my apartment in Camden” and “I want to buy an apartment in camden”.

Context “Type of asset”

We create a “Apartment” Tunnel with the corresponding keywords and which will launch a search in the “District” Context.

And we use the intermediate sequence to store the information by assigning the value “apartment” to the variable “asset_type”.

We then create a “House” Tunnel with the corresponding keywords and which will also launch a search in the “District” Context.

And we use the intermediate sequence to store the information by assigning, this time, the value “house” to the variable “asset_type”.

The chatbot can now make the difference between “I’m looking to sell my apartment in Camden” and “I’m looking for a house for sale in Camden”

Context “District”

In this context, we create simple AI rules to detect each district, each of which will refer to sequences in which we will store the name of the district in the variable “ district”.

To summarize:

In the default context, the chatbot detects the type of transaction then searches for the type of asset in the “Type of asset” context and finally detects the district in the “District” context.

And at each step, the chatbot stores the corresponding info in variables.

So if the user writes “I’m looking to buy an apartment in Camden” the chatbot will detect the intentions and translate them as follows:

  • transaction_type = purchase
  • asset_type = apartment
  • district = camden

The chatbot can then launch the search in the database because this is information that can be used by the search engine.

Detecting multiple intents in a typed sentence is a headache for all AIs around the world. With tunnels, our platform finally offers a pragmatic and effective solution to this problem.

➜ Discover Botnation and launch your chatbot easily!