【问题标题】:what does `'CreateNote'`represent in this section?`'CreateNote'` 在本节中代表什么?
【发布时间】:2018-02-28 22:55:12
【问题描述】:

参考此链接https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-recognize-intent-luis

我拿了这段代码:

// CreateNote dialog
bot.dialog('CreateNote', [
    function (session, args, next) {
        // Resolve and store any Note.Title entity passed from LUIS.
        var intent = args.intent;
        var title = builder.EntityRecognizer.findEntity(intent.entities, 'Note.Title');

        var note = session.dialogData.note = {
          title: title ? title.entity : null,
        };

我不明白的是'CreateNote'在本节中代表什么?

参考这一行:

var title = builder.EntityRecognizer.findEntity(intent.entities, 'Note.Title');

假设我的意图名称是calendar.add,我的实体名称是calendar.location intent.entities calendar.add.calendar.location 会造成任何混乱吗?

【问题讨论】:

    标签: node.js azure-language-understanding


    【解决方案1】:

    这是对话框的内部标识符,可以在需要时引用。

    关于第二部分,我不认为它会造成混淆,但如果你在两周后回到这段代码,你会挠头想为什么它会这样命名,所以它更像是一个在我看来,物流之类的东西。

    【讨论】:

    • 我编辑了我的问题,你能回答另一半吗,所以我标记为已回答。
    【解决方案2】:

    取自官方https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-dialog-manage-conversation-flow。 'CreateNote' 是对话框的标识符,可以这样使用:

    var inMemoryStorage = new builder.MemoryBotStorage();
    var bot = new builder.UniversalBot(connector, 
    function (session) {
        session.send("Welcome");
        session.beginDialog('perroDialog'); //Use beginDialog with the 
        //dialog identifier for starting perroDialog
    
    }
    ).set('storage', inMemoryStorage); // Register in-memory storage 
    
    //--------------------------DIALOGS WATERFALL------------------------
    bot.dialog('perroDialog',
    function (session) {
        session.send('You started perroDialog');
        session.endDialog(); //Back to / dialog (UniversalBot callback)
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-17
      • 2012-10-13
      • 1970-01-01
      • 2011-05-10
      • 2013-04-14
      • 2011-04-11
      • 2012-08-14
      相关资源
      最近更新 更多