问题描述
我在使用dialogflow(api.ai)开发代理时遇到问题。我正在使用很多彼此不同的实体值。但是,某些实体值也有类似的同义词,但是代理只返回一个值。
I have an issue developing an agent with dialogflow (api.ai). I am using a lot of entity values which are all different from one another. however there are similar synonyms for some entity values but the agent is returning only one value.
我如何获得所有可能的匹配项或提出问题以解决歧义
How can i get all the possible matches or ask question to resolve the ambiguity
例如,我的意图是:告诉我ABC快车的位置
for example i have an intent like: tell me the location of ABC express train
if my entity values are :
entity synonym
15127 ABC express
12345 ABC express
我希望它返回两个值或询问问题以解决此类歧义
我该如何解决这个问题
预先感谢
I want it to return two values or ask question to resolve such ambiguity how can i work this outThanks in advance
推荐答案
如果为此目的启用实现,则可以查看用户所说的值,并提出另一个问题,是否需要在实体之间进行歧义消除。
If you enable fulfillment for this intent, you can take a look at the value the user said and ask a further question if you need to disambiguate between entities.
假设您正在提取一个名为 trains的实体。目的中的参数表可能看起来像这样:
Let's imagine you are extracting an entity called "trains". The parameters table in your intent might look like this:
默认情况下,如果用户说 ABC express
,则将使用以下参数哈希值来调用实现Webhook:
By default, if the user says ABC express
, the fulfillment webhook will be called with the following parameter hash:
"parameters": {
"trains": "15127"
}
由于火车15127可能也具有明确的同义词,因此该信息不足以决定请求是否模棱两可。
This isn't enough information to decide if the request was ambiguous, since train 15127 might also have non-ambiguous synonyms.
您可以配置Dialogflow以发送实体的原始文本以及已解析的值。这意味着您将在网络挂钩上收到以下信息:
You can configure Dialogflow to send the original text of the entity, alongside the resolved value. This means you will receive the following information to your webhook:
"parameters": {
"trains": "15127",
"original": "ABC express"
}
您然后可以使用一些简单的逻辑来问一个进一步的问题,即原始
的值是否出现在已知模棱两可的同义词列表中。
You can then use some simple logic to ask a further question if the value of original
appears in a list of known ambiguous synonyms.
要让Dialogflow发送此数据,请修改参数表,使其看起来如下所示:
To have Dialogflow send this data, modify your parameters table so it looks like the following:
这将导致原始同义词与解析值一起发送到Dialogflow。
This will cause the original synonym to be sent to Dialogflow alongside the resolved value.
这篇关于带有不同实体值的相同同义词的dialogflow模糊性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!