# Case: Garbage Sorting Skills
This case explains the task-based skill allocation method without activating words
# Effect display
# Step 1: Create skills
Garbage classification query is an advanced task-based skill, the robot needs to use service interface calls to answer, so we create an advanced skill [garbage classification - no active words] in the robot settings - dialog configuration - advanced skills panel.
# Step 2: Intent Configuration
In the dialogue scenario of garbage classification query, we speculate that the user may have the following intentions:
Ask if the "robot"/Can you carry out "garbage classification query" - [garbage classification - no semantic slot]
Ask directly "what kind of garbage is garbage," for example: ask "what kind of garbage is apple" - [garbage classification - has semantic slot]
Select Continue Query at the end of a conversation (query) - [Continue Query]
We need to create three intents for the above three scenarios, and here we will introduce the concepts and configuration methods used to configure these three intents.
1. Ask if the "robot"/Can you carry out "garbage classification query" ---- intention [garbage classification - no semantic slot]
User Questions: Rule symbols are used to generalize more user queries to improve allocation efficiency. According to the platform rules, we can configure the following user questions:
Semantic Slot Setting and Questioning: After configuring the user query as shown in the above figure, we know the user's intention to query for garbage classification, but we cannot accurately know what kind of garbage the user wants to query. Therefore, we need to understand the concepts of "semantic slot," "dictionary" and "questioning technique" to perfect our configuration.
Semantic slots are keywords contained in the user's statement. Semantic slots help the system to accurately identify the user's intent. For example, "What is the fortune of Gemini today?"#time#、#constellation#and#horoscope#Semantic slots are often used with dictionaries. A semantic slot can be bound to multiple dictionaries, and a dictionary can be associated with different semantic slots.
A dictionary is a canonical collection of natural language phrases, usually defined as a collection of terms in the domain of the application, that can be used for key information extraction and semantic slot invocation in user statements. For example, "wind" and "rain" belong to the dictionary of "weather," "running" and "swimming" belong to the dictionary of "sports." Each dictionary can be reused in multiple skills. The dictionaries supported by the platform can be divided into two categories: system dictionaries and custom dictionaries. Custom dictionary creation method can refer to the platform documentationbasic conceptdictionary
The platform supports to set the semantic slot "whether to ask immediately." If we turn on the open button, we need to configure the semantic slot with the corresponding questioning technique (can be configured with multiple, random selection when questioning). When the user's query does not provide the necessary semantic slot value for dialogue, the robot will automatically ask the user.
For example, under the [Garbage Classification - No Active Words] skill, if the user asks "I want to query garbage classification," and does not give a specific type of garbage, the conversation cannot continue. At this time, if we configure the query, the system will automatically send the query to the user to obtain the semantic slot value.
(Note: The semantic slot "result" here is a backfill of the output result of the API call, please refer to the following [Robot Answer])
Since there is no semantic slot information [garbage name] in the user query we configured, we need to manually configure the query to achieve garbage classification, and the configuration steps are as follows:
- Click Add a Semantic Slot, fill in the name of the semantic slot - [garbage name] in the semantic slot pop-up window, click OK, the name information of the semantic slot will be displayed in the semantic slot settings
- In the dictionary column, click the setup dictionary, and check the dictionary we need on the dictionary settings pop-up page (this dictionary is a custom dictionaryClick to View Custom Dictionary Methods)
- Open the Immediately Ask button and set the Ask statement (you can add more than one). After the configuration is completed, after the user does not get the necessary "garbage name" information, the system will automatically issue a "please tell the garbage name you want to query."
II. Choosing to continue to ask questions after the end of a round of dialogue (inquiry)Intention [continued questioning]
According to the user's speech habits, we know that users often use rhetorical questions when completing a round of garbage classification queries. “that[Garbage name](What rubbish)?” Ask for a second round of questions. In the configuration of user questions, "what about apples," "what about potatoes" for the same sentence. Therefore, we can put the key words in the sentence above[Garbage name]Use slots instead and configure the following user question: What about {garbage name}?
Here we can find that if the semantic slot {garbage name} is added to the user question method, the name of the semantic slot will automatically appear in the semantic slot setting, which requires us to associate the corresponding dictionary for the semantic slot. Because we have already configured the [garbage name] dictionary before, the system semantic slot has been automatically associated with the dictionary, and there is no need to configure it. Of course, we can also modify the associated dictionary as needed.
Considering that the semantic slot [garbage name] has been explicitly referenced in the user query, that is, the semantic slot value of [garbage name] must be provided in the user query to hit this intention, so the semantic slot under this intention does not need to be configured [cross-talk].
3, directly ask "what kind of garbage is garbage," for example: ask "what kind of garbage is apple"Intent [garbage classification - semantic slot]
This is a complete and ideal user representation method, referring to the above intention configuration method and user expression habits, the user question method under this intention can be configured as follows:
# Step 3: Configure the robot to reply
In the robot response configuration of this skill, we choose the "call API resources" approach. This is useful if the reply requires the use of external resources, or if the reply changes with the value of the user's semantic slot. The platform system provides some commonly used API interfaces, such as: ground query, postal code query, express query, etc., for developers to use free. For example: [continue to ask] [classification - semantic slot] These two intentions, you need to call the API interface in order to classify different types of garbage and give a clear reply.
- We first select [Service Interface Call] at the type of reply, and drop down to select [Garbage Classification]:
- Click [Interface Configuration] to match the input parameters to the semantic slot, keeping the semantic slot passing. The output parameters here do not need to be configured by the developer, and the system will automatically slot them and associate them with the interface backfill dictionary. The Result semantic slot of the output parameter is the query result and can be configured directly in the robot reply. If we want to change it, we can also delete the semantic slot name filled in by the system([Results]), redefine the new semantic slot name. After clicking OK, the name of the semantic slot corresponding to the output parameter will be displayed in the semantic slot settings.
- After setting up the interface, we can also debug the interface in the API configuration to see if the API is valid. Enter the name of the garbage you want to query on the debug page to see the status of the returned results.
- Once the configuration is complete, we can configure the corresponding reply results for each query state returned.
Here, for the success of the API call, we successfully query the garbage classification results. We set the semantic slot of the robot reply [results] and reply the results to the consulting user.[Failure] For the API call failed, that is, the corresponding category is not queried, we can set "Sorry, the results of the category are not queried temporarily" as the robot reply.
If the system API does not meet the needs of skill development, the platform also supports developers to upload custom APIs. Developers can click [Custom Interface]>>[Create a custom interface], fill in the interface name, URL, input/Output parameters, return the status can be.
# Step 4: Start multiple rounds of dialogue
If the user's question, instruction or request is more complex and requires multiple rounds of dialogue to complete, we can configure the robot to answer. The jump between intentions is achieved by [ending the conversation] - [not ending the conversation] - selecting the intention to undertake (you can choose more than one).
For example, after configuring the [robot answer] of the three intentions under the "garbage classification-inactivated word" skill, under [whether or not to end the conversation], we choose to jump to the intention of "continue to ask," and we form a multi-round conversation about garbage classification queries. The first round of the conversation is "Please help me query what XX is." the second round of the conversation is "what is XX?" . At the same time, in order to ensure the connection with the upper and lower intentions, the developer needs to select [whether to undertake dialogue] - to undertake dialogue above the jump intention. After opening the [Continue dialogue] setting, the system will enter the current intent only if the user's statement matches the previous intent.Otherwise, the intention question will not be resolved by the system semantics. Multiple rounds of dialogue configuration See more[Case: Shoe price inquiry (multi-round dialogue)]A section.
# Step 5: Debug the release
At the end of the [robot debugging], configure the complete "garbage sorting skills" can be released to your Mini Program and Official Account message template It was.