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

Adding Entities

Entities are variables or parameters, which can be used to configure multiple dialogs of a task-oriented robot to recognize specific customer purposes. They can also be used to temporarily store parameter values in interfaces for future calculation. For example, when a customer needs to purchase a flight ticket, you need to know the departure city, destination city, departure time, and flight company for the flight. The departure city, arrival city, departure time, and flight company can be considered as entities.

Context

Entities can impose specification constraints on the values filled in a slot, similar to defining data types for variables. Some entities are preset, such as system.date, system.time, system.number, and system.phonekeyboard. You can view entities on SYSTEM ENTITY and ENVIRONMENT ENTITY (by choosing Template Management > Entity Management). You can also click Test Entity under My Entity to check whether the variables that you need can be recognized. If the preset entities do not meet your requirements, customize your entities. Customer entities are classified into the following types:

  • General entity: entity corresponding to a single variable. For example, a departure city, a destination city, and a flight company are general entities. For customized general entities, only enumerated values and their synonyms can be set. Complex functions such as fuzzy match cannot be implemented.
  • Composite entity: combination of multiple entities. For example, an identity entity, a city entity, a region entity, and a street entity form a mailing address entity together. Composite entities are usually used to define complex and structured texts.
  • Rule entity: entity that defines a fixed format (prefix and suffix), and part-of-speech rules. When a type of entity has fixed features in sentence expressions, for example, all entities have the same prefix or suffix, you can define a rule entity to expand the capture range of this entity.

During the application of an entity, the system matches the entity values with customer statements. If the matching is successful, the system considers that the entities are contained in the customer statements and uses the entity values for subsequent processing.

Configuring a General Entity

To add a flight company entity, perform the following steps:

  1. Choose Configuration Center > Chatbot Management > Semantic Understanding.
  2. Choose Knowledge Management > Entity Management. Click Create, and choose General entity.
  3. Set Name, click Create to add entity values and their synonyms, and click Save.

  4. Click Test Entity in the upper right corner, and enter an entity value or synonym in the text box. If the AI robot returns @Flight Company=Emirates, the configuration takes effect.

Configuring a Composite Entity

You need to add a location entity that indicates the direction and distance, for example, 100 meters eastwards.

  1. Choose Configuration Center > Chatbot Management > Semantic Understanding.
  2. Choose Knowledge Management > Entity Management. Add a general entity that indicates a direction by referring to Configuring a General Entity. A direction entity includes four elements: East, West, South, and North.
  3. Click Create, and choose Composite entity.
  4. Set Name, and click .
  5. Configure a composite entity.

    1. Select the entity added in 2 from the drop-down list.
    2. Click to add the second drop-down list, and select @system.number (indicating a number) from the drop-down list.
    3. Click to add the third drop-down list, hover the pointer over the drop-down list, click next to the drop-down list to switch from the entity selection mode to the text input mode, and enter Meter.

  6. Click Save.

Configuring a Rule Entity

You need to add a rule entity to identify a company name entity of XXX Co., Ltd.

  1. Choose Configuration Center > Chatbot Management > Semantic Understanding.
  2. Choose Knowledge Management > Entity Management. Click Create, and choose Rule entity.
  3. Set Name.
  4. Set parameters as follows:

    A rule supports the following filtering of a character string:

    • If both Part-of-speech and Suffix are set, the character string that meets the part-of-speech requirement is obtained after the suffix is matched. The length of the character string cannot exceed the value of Maximum length.

      In addition to common adjectives, nouns, numbers, and quantifiers, special nouns are further classified into the following types.

      • Gerund: If you use phrases that can be used as verbs to compose the name of an entity, for example, XX Daily Wholesale Co., Ltd., you can set Part-of-speech to Gerund to better match the entity.
      • Localizer: Without the prefix and suffix, the remaining characters indicate a localizer such as front, back, upper, and lower.
      • OU name: Without the prefix and suffix, the remaining characters indicate an OU group.
      • Place name: Without the prefix and suffix, the remaining characters indicate a city and province.
    • If Part-of-speech is not set, characters between the prefix and suffix are used. The length cannot exceed the value of Maximum length.

      Exact Matching determines whether the prefix and suffix are used for matching.

      Include Prefix In Entity Result and Include Suffix In Entity Result determine whether information corresponding to the prefix and suffix is used as the entity content. For example, in this example, Include Suffix in Entity Result needs to be enabled. The matched entity is XX Co., Ltd.

  5. Click Save.