【问题标题】:Extracting entity in the middle of conversation在对话中间提取实体
【发布时间】:2017-08-07 09:15:03
【问题描述】:
我在 LUIS 中有一个名为 ChangeFlight 的意图。当用户最初输入某种日期格式时,我可以提取日期实体。当用户忘记输入某个日期时,它会要求用户输入一个日期。
但是,我不想只获取响应的结果,而是希望它提取日期实体,例如初始步骤。我有 bot.dialog('askForDate') 向用户询问日期,但我不确定如何在对话中间提取内置日期实体。
我应该如何处理?
谢谢。
【问题讨论】:
-
尼古拉斯的回答能解决你的问题吗?如果您需要有关Prompts.time 中日期时间解析如何工作的更多信息,SDK 使用chrono。如果用户的日期时间仍未被正确解析,那么您可能需要插入像 LUIS.ai 这样的 NLP 来帮助破译话语。
标签:
node.js
entity
extract
botframework
azure-language-understanding
【解决方案1】:
您可以使用专用于时间解析的提示,它将允许用户输入时间或日期/时间。文档是here。
例如:
function (session, results, next) {
if (results.response) {
session.dialogData.name = results.response;
builder.Prompts.time(session, "What time would you like to set an alarm for?");
} else {
next();
}
},
function (session, results) {
if (results.response) {
session.dialogData.time = builder.EntityRecognizer.resolveTime([results.response]);
}
// TO DO : add here what you want to do with the value
}