Disambiguation
处理用户的模糊输入¶
当对话机器人收到一条用户会话时,只有这条会话中包含一个可以被机器人识别的意图时才会进入机器人的对话处理逻辑,但问题是机器人迟早会遇到无法从用户输入中提取意图的情况,当这种情况出现时,最好的策略是单独处理这个逻辑,因为这种情况代表你的对话机器人没有理解或者不太确定用户的意图,Rasa 里面用 policies 来应对这种情况。
看一个例子:¶
policies:
...
- name: rasa_addons.core.policies.BotfrontDisambiguationPolicy
fallback_trigger: 0.30
disambiguation_trigger: '$0 < 2 * $1'
deny_suggestions: 'deny_suggestions'
n_suggestions: 3
excluded_intents:
- ^chitchat\..*
disambiguation_title:
en: "Sorry, I'm not sure I understood. Did you mean..."
fr: "J'ai mal compris. Voulez-vous dire..."
intent_mappings:
password_lost:
en: "Lost password"
fr: "Mot de passe perdu"
login_failed:
en: "Login failed"
fr: "Problème de connexion"
deny_suggestions:
en: "Something else"
fr: "Autre chose"
...
参数说明:¶
参数 | 作用 | 类型 |
---|---|---|
fallback_trigger |
if confidence of top-ranking intent is below this threshold, fallback is triggered. Fallback is an action that utters the template utter_fallback and returns to the previous conversation state. |
string |
disambiguation_trigger |
e.g.: '$0 < 2 * $1' ): if this expression holds, disambiguation is triggered. (If it has already been triggered on the previous turn, fallback is triggered instead.) Here this expression resolves to "the score of the top-ranking intent is below twice the score of the second-ranking intent". Disambiguation is an action that lets the user to choose from the top-ranking intents using a button prompt.In addition, an 'Other' option is shown with payload defined in deny_suggestions param is shown. It is up to the conversation designer to implement a story to handle the continuation of this interaction. |
string |
deny_suggestions |
The intent associated in the payload for the 'Other' option. | string |
excluded_intents |
Any intent (exactly) matching one of these regular expressions will not be shown as a suggestion. | string |
disambiguation_title |
Localized disambiguation message title. | object |
intent_mappings |
localized representative button title for intents. If no title is defined for a given intent, the intent name is rendered instead. These titles support entity substitution: any entity name enclosed in curly brackets ({entity} ) will be filled with entity information from the user utterance. |
object |
::: tip 重要提示
The title for the 'Other' option is also defined here.
:::
最后更新: July 6, 2021