Updated on 2024-10-12 GMT+08:00

Adding an Intention

An intention can be understood as a question of a customer. The customer can achieve a certain goal such as seat booking using one or a group of intentions. During IVR flow orchestration, if the semantic recognition service diagram element is selected, the intention template needs to be configured for the semantic recognition diagram element to recognize customer intentions.

Intentions can be classified into the following types:

  • General Intention: intention driven by corpora. The general intention is the most commonly used. It is usually configured when the Semantic Recognition diagram element is used to recognize the semantic content in the customer statements in a dialog flow.
  • Unknown Intention: intention selected when customer input is not recognized. Each domain needs this type for the intentions not matched in the domain. The unknown intention is preset.
  • Event Intention: intention selected when a specific event is triggered. For example, if a sensitive word configured in the system exists in customer statements, the Sensitive Word event is triggered. The event intention is usually used to match specific events and return the matched events. The Sensitive Word and Clear Context event intentions are preset.

What are the differences between a general intention and an unknown intention?

A general intention is a common intention that contains corpus information. For example, queries about weather and air tickets are general intentions. An unknown intention is an intention that is not recognized and contains no corpus information. It contains only response information.

You need to understand the following concepts during the intention configuration:

  • Corpora are all possible statements of customers for an intention. For example, you need to prepare a template for playing music for customers. In this template, all possible statements related to music playback need to be listed, for example, "Play music for me" and "Play a song".
  • For details about how to add a common corpus, see 3.d. For details about how to add a rule corpus, see How Do I Use a Rule Corpus?.

    Corpora are classified into corpora and rule corpora. What are the differences between a corpus and a rule corpus?

    • Corpus: all possible statements of customers for an intention.

      Slots can be marked in a corpus. When marking slots directly, use a corpus.

    • Rule corpus: corpus that is configured to match the customer input. A rule corpus cannot mark slots, but can be applicable to all expressions of the same sentence. When expressing statements in fixed sentence patterns, use a rule corpus. For example, in [Help me|I want to] (subscribe to a data package|subscribe to the broadband service), the square bracket defines optional rules, the vertical bars (|) indicate multiple choices, and the parentheses define mandatory parts. In this case, subscribe to a data package and subscribe to the broadband service can be recognized through the Semantic Recognition diagram element.
  • Slots are parameters to be collected during dialogs. For example, to implement a train ticket booking intention, a customer needs to provide information such as the departure city, arrival city, and departure time. Such details are called slots. To obtain a customer intention, you can obtain customer information, such as the time, location, and category, and add the information as slots.
  • Entities refer to words that can be understood as parameter values in the voice content of a customer. For example, such words can be 3 kilograms and apple in the content I want to buy 3 kilograms of apples or one, tomorrow, and Beijing in the content One train ticket to Beijing tomorrow. The difference of the entity and slot is as follows: A slot represents the nature of an intention. An entity is not dedicated to an intention but used to fill a slot. In this way, modeling is performed for parameters and values separately.

Based on Table 1, you need to add two intentions and two entities. You can use the two preset entities. The following describes how to add an appointment intention.

Procedure

  1. Add a domain. For details, see Adding Domains.
  2. Add a doctor entity and department entity. For details, see Adding Entities.

    Figure 1 Adding a doctor entity
    Figure 2 Adding a department entity

  3. Add an appointment intention.

    1. Go to the new domain, click Create, and choose General Intent.
    2. Enter an intention name, for example, Appointment.
    3. On the Context tab page, click Create in the Input Context area to add a context for the current intention. In this example, no context is added.

      Context indicates that the robot processes multiple groups of statements as the same round of dialogs based on the value in a multi-round dialog. When an intention is specified, character strings configured in the context can be used to locate it.

      An intention context can be understood as the dialog memory of a robot. A robot identifies and handles multiple rounds of dialogs that have the same context as one task. For example, by multiple rounds of Q&A, a robot successively obtains the departure time, departure location, and destination for flight reservation. When the robot receives other contexts in the flight reservation context, such as a weather query context, the robot switches to a new intention that corresponds to the customer's questions. In this way, multi-intention conversion is realized.

    4. On the Corpus tab page, click Create.

      Analyze the customer's possible answers and add the answers to the corpus. For example, if the customer may answer "I want to appoint Dr. Li's Internal Medicine at 16:00 tomorrow afternoon", double-click the text box and enter I want to appoint Dr. Li's Internal Medicine at 16:00 tomorrow afternoon. Then, select tomorrow afternoon and choose @system.date from the displayed menu, and select 16:00 and choose @system.time from the displayed menu.

      How to mark a slot?

      After the corpus is entered, press Enter to automatically mark the slot. However, some corpora are special (such as this example), that is, the slot that is automatically marked after you press Enter does not meet the requirements. Therefore, you need to manually mark the slot.

      You can add the following corpus information.

    5. On the Slot tab page, set the slot name, whether the slot is mandatory, and the question information provided by the system when the slot information is missing.

      The name of the slot will be part of the slot variable name used during flow orchestration.

      The complete time, date, department, and doctor must be provided to confirm an appointment. Therefore, the four slots are mandatory. Enable Mandatory for them.

    6. On the Response tab page, click Add, and configure the command word returned after the intention matching succeeds.

      Response means the text or command word to be reported when the intention is matched. A response can return different texts or command words depending on the condition expressions. When you need a matched intention to return prompt information to the customer, configure the TTS. When you need a matched event to be written into TOC.IntentCode and returned to the invoker (for example, the dialog flow), configure the command word.

      Click the Command text box, and set it to finish.

      Click , set Reply Type to TTS, and set Reply to You have appointed {$doctor}'s {$room} at {$time} on {$date}.

    7. Click Save in the lower right corner.
    8. Click Train in the upper right corner. A message is displayed, indicating that the training is successful.
    9. Click Test in the upper right corner to test the current intention.

      If you have configured the context when adding an intention, enter the configured context in the context text box on the chat page before asking the robot. Otherwise, you do not need to enter the context.

      During the test, ask the robot based on your corpus and check the robot reply. If the following information is displayed, the matching is successful.