Updated on 2023-09-20 GMT+08:00

Adding Intention Templates

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 about playing music for users. In this template, all possible statements related to music playing need to be listed, for example, "Play music for me" and "Play a song".
  • For details about how to add a common corpus, see 2.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 subscribers 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 operator input. A rule corpus cannot mark slots, but can be adapted to all expressions of the same sentence. When expressing statements in fixed sentence patterns, use a rule corpus.
  • Slots are parameters to be collected during dialogs. For example, to implement a train ticket booking intention, a subscriber needs to provide information such as the departure city, arrival city, and departure time. Such details are called slots. To obtain a subscriber intention, you can obtain subscriber 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 voice content "I want to buy 3 kilograms of apples" or "one", "tomorrow", and "Beijing" in the voice 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 four intentions without adding entities. You can use the preset entities. The following describes how to add an intention template for confirming the meal time.

  1. Add a domain.
  2. Add an intention.

    1. Go to the new domain, click Add, and select General Intention.
    2. Enter the name of the intention, for example, Meal Time Confirmation.
    3. On the Context tab page, click Add next to Input Context, and add the context of the current intention as service.

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

    4. On the Corpus tab page, click Add.

      Analyze the customer's possible answers and add the answers to corpora. For example, if the customer answers 12:00 on April 12, 2019, double-click the text box and enter 12:00 on April 12, 2019. Then, select April 12, 2019, choose @system.date from the displayed menu, select 12, 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 and date must be provided to confirm the booked dining time. Therefore, the two slots are mandatory. However, the dialog flow is connected, and the dialog flow is used to control the filling of slot information. Therefore, the setting here must be optional.

    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 TIME.

      Click the Command text box or the Add Reply button, and set Reply Type to TTS. Click the Enter a command. text box, and set the value to When will you have dinner?.

    7. Click SAVE in the lower right corner.
    8. Click Train in the upper right corner.
    9. Click Ask Chatbot in the upper right corner to test the current intention template.

      If you have configured the context when adding an intention, enter the configured context in the context selection box on the chat page before asking the chatbot.

      During the test, ask the chatbot according to your corpus and check its response. If the following information is displayed, the matching is successful.