Intents

更新时间:
复制 MD 格式

An intent is identified through single or multi-turn conversations. A complete intent can contain the following parts: user utterances and semantic slots.

User utterances

User utterances are the phrases that trigger an intent. Because the algorithm supports semantic generalization, you do not need to configure multiple similar phrases.

Examples of similar expressions include "I want to buy a train ticket," "buy a train ticket," and "buy one train ticket."

Examples of different expressions that convey the same intent include "I want to buy a train ticket," "I want to travel by train," and "take a train to xx for fun."

Advanced semantic configuration

The formatting rules follow LGF.

Best practices

You should start with the simplest LGF expressions and gradually build up to more complex ones. This section only covers LGF with the Strict match option enabled. The final part of this section explains the changes and enhancements that occur when you disable Strict match.

Simplest LGF

The simplest LGF expression is plain text. For example, with the Strict match option enabled, the expression "Today's Beijing weather" only matches the exact input "Today's Beijing weather."

Optional parts

You can use square brackets `[]` to mark parts of the text as optional. For example, `['s]` makes a part of the text optional. The LGF expression `Today Beijing['s] weather` can match two inputs: "Today Beijing weather" and "Today's Beijing weather." You can add optional markers in different places to double (x2) the expression's matching capability. For example, the following expression can match four inputs: `Today Beijing['s] weather [forecast]`.

Logical OR

You can use the pipe character `|` to represent a logical OR relationship. This allows an expression to match multiple alternatives. To avoid ambiguity when you use `|`, enclose the alternatives in parentheses `()`, as shown in the following example: `(Today|Tomorrow|The day after tomorrow) Beijing['s] weather [forecast]`. In addition to using `()` for isolation, if the logical OR group is also optional, you can use square brackets `[]` for isolation, as shown in this example: `(Today|Tomorrow|The day after tomorrow) Beijing['s] weather [forecast|conditions|status]`.

Parameter expressions

The previous examples are all text expressions in LGF. However, when you build a conversation in Dialog Studio, you need to fill many parameters. For example, the weather example requires two parameters: "time" and "location." In LGF, you can use `${}` to reference a specific parameter. Note: You must use the parameter name, not the source noun. The following expression can hit many specific expressions, such as "Tomorrow Hangzhou's weather conditions," "Guangzhou weather on the 2nd," and "Shenzhen weather status the day after tomorrow": `${date}${city}['s] weather [forecast|conditions|status]`.

Wildcard generalization

LGF features such as optional parts and logical OR enhance matching capabilities. However, they may not be sufficient for the generalization needs of some applications. For example, a developer may want to cover a wider variety of prefixes and suffixes, as shown in the following expression. Note: This assumes the Strict match option is still enabled. `[Please tell me|Check|Tell me] ${date}${city}['s] weather [forecast|conditions|status] [how is it|what is it like|is it good]`. To address this need, LGF also supports wildcard characters. The syntax is `.{min,max}`. For example, `.{0,3}${date}${city}['s] weather [forecast|conditions|status].{0,3}`. The expression `.{0,3}` matches zero to three of any character. A UTF-8 character, such as a Chinese character, counts as one character. The preceding expression can accommodate some prefixes and suffixes. However, be aware that this type of generalization can be unpredictable. It might solve some issues but introduce others. If you have this requirement, consider disabling the Strict match option first.

Similarity generalization

If you find wildcard generalization too imprecise, you can try similarity generalization. To use this feature, disable the Strict match option. When Strict match is disabled, LGF uses a similarity method for generalization. For example, it can match similar phrases such as "I want to order takeout," "Help me order takeout," and "Order takeout for me."

Element descriptions

Validation rules and prompts

When you edit and save an LGF rule, the system checks the syntax and provides prompts. The prompts fall into two categories:

  • Error: Indicates a syntax error, a reference to a non-existent entity, or a configuration that could severely impact the application's performance. You cannot save a rule that contains an error.

  • Warning: Indicates that the syntax is valid but does not follow best practices. You can save a rule that contains a warning.

  • The following are examples of error and warning messages:

Semantic slot recommendations

You can set semantic slots to help the bot identify key information in user utterances and better understand the user's intent.

The system can automatically recommend semantic slots in the utterance. You can click the recommended semantic slots and edit them.

Semantic slot tagging

If a user utterance does not contain parameters for the required slots, you can add the parameters and use the tagging feature to complete the task.

For example: I want to buy a train ticket for tomorrow from Hangzhou to Beijing.

After tagging, the value in the Source Name column for each parameter changes to the value that you tagged. If multiple tagged words correspond to the same parameter, you can select the slot to merge them.

Tip: Tagging helps you quickly generate slots and accurately extract keywords from sample sentences.

For example: I want to buy a train ticket from Beijing to Hangzhou.

In this sentence, Beijing and Hangzhou are both Chinese cities. If a user only says "Beijing" or "Hangzhou," the system cannot identify which is the origin and which is the destination. Using the tagging feature, you can identify the origin and destination based on the sample utterance.

Additionally, if you tag Beijing and Hangzhou as the origin and destination, the system can identify "Tianjin" and "Guangzhou" as the corresponding parameters in a similar utterance, such as "travel from Tianjin to Guangzhou."

Delete a tagged annotation

To delete a single tagged annotation, select the tagged word and click the Remove Annotation button that appears above it.

To delete all tagged annotations of a specific type, you can delete the corresponding parameter. All tagged words related to that parameter are also removed.