代码之家  ›  专栏  ›  技术社区  ›  Kirsten

未正确识别LUISINT属性

  •  0
  • Kirsten  · 技术社区  · 6 年前

    我正在修一门课程 Getting Started with Building Bots on the Microsoft Bot Framework 使用课程中的一些代码。

    当我在机器人仿真器中键入“Hi”时,Luis意识到这是一个问候意图,但是机器人将其理解为“无意图”,并说“对不起,我不知道你的意思”

    [Serializable]
    public class LUISDialog : LuisDialog<BugReport>
    {
     private readonly BuildFormDelegate<BugReport> NewBugReport;
    
     public LUISDialog(BuildFormDelegate<BugReport> newBugReport)
     {
        this.NewBugReport = newBugReport;
     }
    
    [LuisIntent("Greeting")]
    public async Task Greeting(IDialogContext context, LuisResult result)
    {
        context.Call(new GreetingDialog(), Callback);
    }
    [LuisIntent("")]
    public async Task None(IDialogContext context, LuisResult result)
    {
        await context.PostAsync("I'm sorry I don't know what you mean."); 
        context.Wait(MessageReceived);
    }
    

    下面显示的结果是调试器中的问候语:

    in the debugger

        {
      "luis_schema_version": "3.0.0",
      "versionId": "0.1",
      "name": "sbdbotapp",
      "desc": "",
      "culture": "en-us",
      "intents": [
        {
          "name": "GreetingIntent"
        },
        {
          "name": "NewBugReportIntent"
        },
        {
          "name": "None"
        },
        {
          "name": "QueryBugType"
        }
      ],
      "entities": [
        {
          "name": "BugType",
          "roles": []
        }
      ],
      "composites": [],
      "closedLists": [],
      "patternAnyEntities": [],
      "regex_entities": [],
      "prebuiltEntities": [
        {
          "name": "email",
          "roles": []
        }
      ],
      "model_features": [],
      "regex_features": [],
      "patterns": [],
      "utterances": [
        {
          "text": "bug report",
          "intent": "NewBugReportIntent",
          "entities": []
        },
        {
          "text": "can you check whether foo is a bugtype?",
          "intent": "QueryBugType",
          "entities": [
            {
              "entity": "BugType",
              "startPos": 22,
              "endPos": 24
            }
          ]
        },
        {
          "text": "create bug",
          "intent": "NewBugReportIntent",
          "entities": []
        },
        {
          "text": "good afternoon",
          "intent": "GreetingIntent",
          "entities": []
        },
        {
          "text": "good evening",
          "intent": "GreetingIntent",
          "entities": []
        },
        {
          "text": "good morning",
          "intent": "GreetingIntent",
          "entities": []
        },
        {
          "text": "hello",
          "intent": "GreetingIntent",
          "entities": []
        },
        {
          "text": "hey",
          "intent": "GreetingIntent",
          "entities": []
        },
        {
          "text": "hi",
          "intent": "GreetingIntent",
          "entities": []
        },
        {
          "text": "hi there",
          "intent": "GreetingIntent",
          "entities": []
        },
        {
          "text": "i have a problem",
          "intent": "NewBugReportIntent",
          "entities": []
        },
        {
          "text": "is security a bug type?",
          "intent": "QueryBugType",
          "entities": [
            {
              "entity": "BugType",
              "startPos": 3,
              "endPos": 10
            }
          ]
        },
        {
          "text": "something doesnt work",
          "intent": "NewBugReportIntent",
          "entities": []
        },
        {
          "text": "yo",
          "intent": "GreetingIntent",
          "entities": []
        }
      ]
    }
    

    1 回复  |  直到 6 年前
        1
  •  1
  •   Matt    6 年前

    这是因为您的意图的名称是“greetingIntent”,并且在代码中您将其标记为“greeting”。将您的代码更改为“greetingIntent”,它应该可以工作。

    推荐文章