2017-08-07 28 views
0

我在LUIS有一个名为ChangeFlight的意图。当用户最初输入某种日期格式时,我可以提取日期实体。当用户忘记输入日期时,它会要求用户输入日期。在对话中提取实体

但是,我不想仅获取响应的结果,而是希望它提取日期实体,如初始步骤。我有bot.dialog('askForDate'),它向用户请求日期,但我不确定如何在对话中提取内置日期实体。

我该如何处理? 谢谢。

+0

不Nicolas的回答解决你的问题?如果您需要更多关于“Prompts.time”中的日期时间解析如何工作的信息,则SDK使用[chrono](https://github.com/wanasit/chrono)。如果用户的日期时间仍未被正确解析,那么您可能需要插入像LUIS.ai这样的NLP来帮助破译话语。 –

回答

0

您可以使用专用于时间分辨率的提示,它将允许用户输入时间或日期/时间。 doc是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 
}