Baidu UNIT Intents and Entities
UNIT is Baidu's Natural Language Processing offering, supporting Simplified Chinese. Full documentation is available on the UNIT site.
Before linking up your intents and entities, be sure to first connect your Baidu UNIT agent's Cloud Configuration to your bot.
The first step is to fetch your agent's intent name. To do this, launch UNIT, select the agent whose intents you are using and click Intents in the side navigation.
Here you can see all the intents associated with this agent. These are the intent names you will need to use in the Stackchat Bot Builder.
To trigger navigation to a Stackchat flow when this intent is detected, open the Configure AI dialogue for the Flow you want to navigate to.
In the overlay, add the intent name from UNIT that you want to map to the Flow. Be sure to copy it exactly, as it is case-sensitive. All UNIT intents are in all caps.
Paste the intent name into your desired location in Stackchat.
Now, you can enter the entities associated with that intent. You can see all the entities associated with an intent by clicking on it in UNIT.
Whereas intents represent the user's overall intention in their utterance, entities represent key words in the utterance that we want to extract. There are three types of entities in UNIT, custom entities (those created by you), system entities (pre-built entities provided by UNIT in order to facilitate handling the most popular common concepts), and hybrid entities, which are a combination of system and custom entities.
Custom and hybrid entities are no more difficult than dealing with the intent, in that it is a one-to-one mapping between Dialogflow and Stackchat. For example, in the Weather intent used above, there is one custom entity,
Copy the text found in the 词槽名称 column of UNIT for the entity you are mapping.
And paste that value into Stackchat and select the Stackchat slot you wish to map it to. In this example, the Stackchat slot has the same name as the Dialogflow entity to prevent confusion.
UNIT system entities follow the same naming convention as custom or hybrid entities, i.e. all names start with
user_ and the remaining at the user's discretion. The user selects which system entity library or libaries they wish to use when creating the entity.
For many system entities, UNIT returns both original and normalized values. The original value is exactly what the user entered, while the normalized value converts that data into a standardized format. For example, if the agent extracts the entity "Tuesday", the original value will be "Tuesday", while the normalized value will be "YEAR-MONTH-DAY".
For some sytem entities such as location, Stackchat returns the original value, but there are some specific cases like the date example above, for which the original value is not useful. In these cases, Stackchat returns the normalized value.
In order for Stackchat to recognize that you wish to use the normalized value, there is a fixed naming convention that must be followed, as seen in the table below. Failure to follow this convention will result in UNIT returning the original value.
The general convention is
MEANINGFUL_NAME can be named at your discretion or omitted entirely (although we highly recommend using it if you have multiple entities employing the same). UNIT entity names can only be 16 characters long, excluding
user_, so space for the meaningful name is limited.
|System Entity||Name for Use in Stackchat|
The system time entity covers both times and dates.
All other system entities return their original value.
Once you have the naming convention in place, simply copy and paste the intent name into the Configure AI dialogue as you would with a custom or hybrid entity.