2016-11-19 45 views
2

我正在嘗試構建一個與LUIS模型交談的bot。機器人將有35個場景,每個對應於LUIS意圖。目前,LUIS支持最多20個意圖。 如何在我的代碼中對此進行縮放?我想知道是否最好有一個LUIS模型層次結構,父模型調用特定的子模型。或者我應該在我的數據庫中維護一個關鍵字列表,並根據它調用特定的模型。我需要幫助來評估這兩種方法的優缺點。謝謝!LUIS限制意圖數量爲20

+1

意圖的限制最近從80提高到500檢查了這在https://docs.microsoft.com/en-in/azure/cognitive-services/luis/luis-boundaries –

回答

2

我建議你儘可能地使用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借來的。

+1

謝謝!另外,在下一個LUIS發佈中,似乎意圖數量將會放寬。 – happydevdays

+0

@happydevdays很棒,但要小心定價:P – jcmontx

+0

現在最多可以有40個意圖 – JPThorne