nlp - LUIS 将意图数量限制为 20

标签 nlp botframework azure-language-understanding

我正在尝试构建一个与 LUIS 模型对话的机器人。该机器人将有 35 个场景,每个场景对应一个 LUIS 意图。目前,LUIS 支持最多 20 个意图。 我如何在我的代码中扩展它?我想知道是否最好有一个 LUIS 模型层次结构,其中父模型调用特定的子模型。或者我应该在数据库中维护一个关键字列表并根据它调用特定模型。我需要帮助来评估这两种方法的优缺点。谢谢!

最佳答案

我建议您尝试使用 BestMatchDialog 替换尽可能多的场景(至少 15 个)。

您仍将使用 LuisDialog 作为根对话框。 这是一个例子:

 [Serializable]
public class GreetingsDialog: BestMatchDialog<bool>
{
    [BestMatch(new string[] { "Hi", "Hi There", "Hello there", "Hey", "Hello",
        "Hey there", "Greetings", "Good morning", "Good afternoon", "Good evening", "Good day" },
       threshold: 0.5, ignoreCase: true, ignoreNonAlphaNumericCharacters: true)]
    public async Task WelcomeGreeting(IDialogContext context, string messageText)
    {
        await context.PostAsync("Hello there. How can I help you?");
        context.Done(true);
    }

    [BestMatch(new string[] { "bye", "bye bye", "got to go",
        "see you later", "laters", "adios" })]
    public async Task FarewellGreeting(IDialogContext context, string messageText)
    {
        await context.PostAsync("Bye. Have a good day.");
        context.Done(true);
    }

    public override async Task NoMatchHandler(IDialogContext context, string messageText)
    {
        context.Done(false);
    }
}

在您的 LuisDialog 中您可以这样调用它

 [LuisIntent("None")]
    [LuisIntent("")]
    public async Task None(IDialogContext context, IAwaitable<IMessageActivity> message, LuisResult result)
    {
        var cts = new CancellationTokenSource();
        await context.Forward(new GreetingsDialog(), GreetingDialogDone, await message, cts.Token);
    }

上面的代码借自Ankitbko's MeBot repo .

关于nlp - LUIS 将意图数量限制为 20,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40688176/

相关文章:

c# - 在 C# 中从 FormFlow 调用 LUIS

c# - 如何正确地为单词添加 "a"和 "an"前缀?

machine-learning - 数据集不平衡、大小限制 60mb、电子邮件分类

java - 当改变对话视角时,如何可靠地将 "you"替换为 "me"或 "I"?

c# - 如何在两个不同语言的 luis.ai 对话框之间切换

node.js - 当机器人在 Teams 中发送消息时,如何收到通知?

c++ - 有没有好的 C++ 后缀 Trie 库?

c# - 在没有 IDialogContext 的情况下从 scorable 访问用户数据包

c# - 在 LuisIntent 方法中处理自适应卡按钮

artificial-intelligence - luis.ai 与 api.ai 与 wit.ai 之间的比较?