Function and general information
NLU slot – a slot designed to implement speech recognition of the Interlocutor by an Agent for processing messages in natural language in order to determine the expressed intention (Intent) of the interlocutor and, depending on the specific intent, make the transition to the appropriate branch of the Script.
NLU slot is a complex slot and can not exist without the Intent child sub-slots and the Fallback sub-slot, which start their own branches, to which the transition is carried out after the recognition of the corresponding intention.
NLU slot processes the incoming request of the Interlocutor, previously recorded in the client_message variable.
NLU slot recognizes only those intents that are enclosed in its Intent sub-slots. The other possible intentions of the Interlocutors (intents) do not participate in recognition in this NLU slot. For example, in the image above, the NLU slot will be trained to recognize only two interns that are selected in its Intent sub-slots. If none of these intents is recognized, the communication will move to the Fallback sub-slot.
Creating and configuring an integrated NLU slot (NLU + Intent + Fallback)
- NAME – slot name
- CONFIDENCE THRESHOLD – expressed as a percentage, the minimum value of confidence in the recognized intent, at which the intent is considered recognized, and the communication goes to the branch of the corresponding Intent sub-slot. The Confidence threshold value can be an integer from 0 to 100.
- Confidence Threshold value depends on the number of intents in the Script Tree. It is recommended that the value be inversely proportional to the number of Intent sub-slots in the Scenario: the more intents, the smaller the Confidence Threshold should be.
- At the begining it is recommended to first set the value equal to 15 – with such Confidence Threshold, recognition is most successful for most Bots. Depending on the results of testing Confidence Threshold bot, it will be possible to change it. For more information, see Selecting the optimal Confidence Threshold value.
- Each message of the Interlocutor is assigned Confidence value (a number from 0 to 1). Confidence characterizes the confidence of Bot that the message refers to a certain intent.
- Confidence Threshold value is the minimum Confidence value expressed as a percentage, at which the Bot moves into the slot of one of the intents. If Confidence value is less than Confidence threshold, Bot moves to Fallback slot.
NLU slot is trained on samples of intents added as its Intent subslots.
At the input NLU slot accepts client_message variable, processes the variable, recognizing the intent, and translates communication with the Interlocutor into the branch of the recognized intent. If no intent is recognized with the proper level of confidence, the communication goes into the Fallback sub-slot.
Intent and Fallback sub-slots
Automatic generation of sub-slots when creating NLU
While creating NLU slot, two Intent sub-slots and Fallback sub-slot are automatically created. If no intents have been created beforehand, sub-slots with automatically generated intents will be created behind the NLU slot
In order to replace the intents in the generated sublot, expand it by double-clicking the mouse. By clicking on the name of the intent in the INTENT field and select the desired intent from the drop-down list. Then click Save.
Adding Intent Sub-slots
In order to add a new sub-slot, you need to click on the + button.
The new sub-slot will be displayed in the Scenario above the Fallback sub-slot, which is always located at the bottom.
The process of intent recognition
- Training: NLU slot is trained on samples of intents added as its Intent sub-slots and then becomes part of the trained Agent model.
- Getting a phrase: NLU slot in the trained Agent model at the input accepts phrases of Interlocutors and text from client_message variable.
- Phraseclassification: The trained Agent model classifies the Interlocutor’s replica from client_message variable and arranges all the intents of this NLU slot according to the level of confidence in them – Confidence (as a percentage, similar to Confidence Threshold).
- Transition to intent: the transition is carried out to the intent with maximum Confidence, provided that Confidence >= Confidence Threshold in the settings of this NLU slot, and is the intent by which the Interlocutor’s phrase is recognized.
As a result:
- Communication will move to the branch of this sublot Intent;
- Intent variable is created in the system context variables – the identifier of the recognized intent;
- In system context variables, a confidence variable is created – the degree of confidence of the Bot that the Interlocutor’s phrase refers to this intent (in percent);
- Intent and confidence variables are stored in the Chat context until the next execution of the same or another NLU slot in this Chat .
Transition to Fallback: Transition to the Fallback sub-slot is carried out if the Confidence of all intents is lower than the Confidence Threshold value in the settings of this NLU slot. This means that none of the intents were recognized.
As a result:
- Communication will go to the branch of this Fallback sub-slot;
- An error variable is created in the system context variables – the error text. The error variable exists in the Chat context before:
- The next execution of the same or another NLU slot;
- Regular Expression slot Execution;
- Execution of the ExternalRequest slot.
Example: In this case, the Interlocutor’s phrase was attributed by NLU slot to the Internet 1analytics, and the Script moved on to the corresponding branch of this intent.