DialogFlow-获取与参数关联的原始字符串 [英] DialogFlow - Get original string associated with parameter

查看:66
本文介绍了DialogFlow-获取与参数关联的原始字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个查询,例如:

Suppose I have a query like:


从下午5点到晚上11点开灯。

Turn on the lights from 5pm to 11pm.

我有一个时间周期实体,该实体与 5pm to 11pm匹配,并且代理正确地将该实体解析为响应中的两个DateTime对象。但是,我需要获取原始文本片段到参数的映射,即原始文本->参数名称,例如下午5点到晚上11点映射到时间段实体。理想情况下,我想要原始文本以及已解析的对象。

I have a time-period entity that matches "5pm to 11pm", and the agent correctly parses the entity into two DateTime objects in the response. However, I need to get a mapping of the snippets of original text to the parameter, i.e. Original Text -> Parameter Name, e.g. "5pm to 11pm" maps to the "time-period" entity. Ideally, I would like the original text along with the parsed objects. Is this possible?

推荐答案

如果仅使用参数,则无法从用户查询中获取原始文本。 Dialogflow仅会为您提供解析日期。如下图所示,只有解析的 startTime endTime

If you are using just parameters, then it is not possible to get the original text from the user query. Dialogflow will only give you the parsed date. As you can see in the image below, there is only parsed startTime and endTime.

但是,如果您在意图中设置了上下文,则可以同时获取解析日期和用户输入的原始文本。如下图所示,既有带。原始后缀的原始文本,也有转换后的 startDate endDate

However, if you set a context in your intent, then you can get the value of both parsed date and the original text that user has entered. As you can see in the image below, there is both original text which is with .original suffix and the converted startDate and endDate.

您可以在意图中设置一个输出上下文,其生命周期为1,只是为了获得该值。

You can set an output-context in the intent, with life-span of 1, just to get this value.

希望有帮助。

这篇关于DialogFlow-获取与参数关联的原始字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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