在dialogflow中处理直接和上下文问题的正确方法是什么? [英] What is the right approach for handling direct and contextual questions in dialogflow?

查看:103
本文介绍了在dialogflow中处理直接和上下文问题的正确方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Dialogflow创建一个HR聊天机器人。我无法找出使机器人程序处理直接问题和以上下文方式提出的问题的正确方法。例如:

I am creating a HR chatbot using Dialogflow. I am unable to figure out the right approach to have the bot handle both direct questions and questions asked in a contextual manner. For example:

用户:我想知道我可以从中得到多少片叶子年

User: I want to know how many leaves i can get in a year

批处理:您得到x片叶子

Bot: You get x number of leaves

用户:好了,我该如何申请?

User: Ok cool how do i apply for one then?

博特:按照此流程申请请假

Bot: Follow this process to apply for a leave

对话1:

用户:我想知道一年中我可以得到多少片叶子

User: I want to know how many leaves i can get in a year

批处理:您得到x片叶子

Bot: You get x number of leaves

对话2:

用户:我想知道如何申请休假

User: I want to know how to apply for leave

Bot:请按照以下流程申请休假

Bot: Follow this process to apply for a leave

我尝试过的方法:

1)添加输入和输出上下文以处理上下文情况并向知识库中添加直接问题。
这种方法的问题在于,由于我们不能在知识库中给出多个短语,因此大多数直接问题都不匹配

1) Adding input and output contexts to handle contextual cases and add direct questions to knowledge base. The issue with this approach is that since we cannot give multiple phrases in knowledge base, most direct questions do not match

2)有2个意图,一个意图输入和输出上下文以及一个用于处理直接问题的上下文。 (例如:一种意图是 leaves.apply.context ,它既设置了输入和输出上下文,又设置了训练短语,例如申请此和另一个意图 leaves.apply.direct ,其中包含诸如的培训短语如何申请假期并且没有上下文)。我不相信这是正确的方法,因为我实质上是针对同一问题创建具有相同答案的两个意图。

2) Have 2 intents, one with input and output contexts and one to handle direct questions. (For example: One intent would be leaves.apply.context which would have both input and output context set and would have training phrases like how do i apply for this and another intent leaves.apply.direct which would have training phrases like how do i apply for a leave and no context). I'm not convinced that this is the right way as I am essentially creating two intents for the same question with the same response.

那么是否有解决此问题的推荐方法?

So is there a recommended approach to solve this problem?

推荐答案

我认为没有推荐的方法,这是一个品味问题。您的解决方案是解决此问题的一种好方法,但我认为您不会回避这样一个事实,即如果您想允许后续问题也可以直接解决,那么您必须做出同样的回答来表明自己的意图。

I don't think there is a recommended approach to this, it is a matter of taste. Your solutions are a nice way of approaching this, but I don't think you will get around the fact that you will have to make an extra intent with the same response if you want to allow a follow-up question to also be approachable directly due to the context.

如果您真的不想为相同的响应创建两个意图,我认为您可以通过创建两个意图来锻炼这种情况。并删除上下文流。只需创建一个没有任何上下文的 HowManyLeavesAvailableIntent HowToApplyForLeaveIntent 并训练 HowToApplyForLeaveIntent 触发将跟踪 HowManyLeavesAvailableIntent 的短语,并直接提出有关 HowToApplyForLeaveIntent 的问题。由于缺少上下文,这可能不是理想的,因为它可以创建与意图的怪异映射,但是它使您仅可以就如何申请请假拥有一种意图。

If you really don't like to create two intents for the same response, I think you would be able to workout this scenario by creating two intents and dropping the contextual flow. Just create a HowManyLeavesAvailableIntent and a HowToApplyForLeaveIntent without any context and train the HowToApplyForLeaveIntent to trigger on phrases that would follow-up HowManyLeavesAvailableIntent and direct questions for HowToApplyForLeaveIntent. Due to the missing context, this might not be ideal because it can create weird mappings to intents, but it would allow you to have just one intent for how to apply for leave.

这篇关于在dialogflow中处理直接和上下文问题的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆