有没有办法将 QnA 问题转换为 LUIS 意向话语

Is there a way to convert QnA Questions into LUIS Intent Utterances

我按照这个 Microsoft 文档实现了一个使用 LUIS 将用户问题路由到 QnAMaker 的机器人:https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-tutorial-dispatch?view=azure-bot-service-4.0&tabs=cs

基本上我在V3文档中注意到了(https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/tutorials/integrate-qnamaker-luis)(因为在V4中没有提到它) 它说:

Add an intent for each QnA Maker knowledge base. The example utterances should correspond to questions in the QnA Maker knowledge bases.

我的问题是,除了将 QnA Maker 中的所有问题手动复制到每个 Intent(假设我有多个 KB)之外,还有更简单的方法吗?例如从 QnA Maker 或类似的东西导出文件?

这是使用 Dispatch 工具完成的。本质上,它所做的是从您的 QnA Maker 知识库下载问题,并创建一个名称中包含 "dispatch" 的新 LUIS 应用。在这个新应用程序中,将为您的每个 QnA Maker 知识库添加一个意图,命名为 q_<kb_name_here>,相关知识库中的问题将作为话语添加到该意图中。

您链接的文档的 Create the dispatch model 部分概述了如何执行此操作。

您需要安装 npm 附带的 NodeJS 才能从 CognitiveModels 文件夹中的命令行执行以下操作(粗略指南):

// install botdispatch package
npm i -g botdispatch

// initialise a dispatch file
dispatch init -n <filename-to-create> --luisAuthoringKey "<your-luis-authoring-key>" --luisAuthoringRegion <your-region>

// add references to luis and qna apps
dispatch add -t luis -i "<app-id-for-weather-app>" -n "<name-of-weather-app>" -v <app-version-number> -k "<your-luis-authoring-key>" --intentName l_Weather
dispatch add -t luis -i "<app-id-for-home-automation-app>" -n "<name-of-home-automation-app>" -v <app-version-number> -k "<your-luis-authoring-key>" --intentName l_HomeAutomation
dispatch add -t qna -i "<knowledge-base-id>" -n "<knowledge-base-name>" -k "<azure-qna-service-key1>" --intentName q_sample-qna

// generate a dispatch model
dispatch create

然后在 LUIS 门户中,您必须先找到您的新应用并发布它,然后才能使用它。然后按照 Use the dispatch model 下的步骤利用 LUIS 进行路由。