2017-12-06 5 views
2

私はLUISに接続されたチャットボットを持っていますが、ダイアログは最も一致するインテントのものにしか入りませんが、残りのスコアそれを行う方法はありますか? 私はすでにこれまでのところ、これは私が使用しているものですC#LUIS ChatbotはLuisResultからすべてのインテントを抽出します

[LuisModel("XXXX", "XXXX", Verbose = true)] 

を持っている:私のボットのみなし意図を返します。しかし

[LuisIntent("")] 
    [LuisIntent("None")] 
    public async Task None(IDialogContext context, LuisResult result) 
    { 

     string allIntents = ""; 



     //Loop throught all intents found in JSON 
     foreach (var foundIntent in result.Intents) 
     { 
      allIntents += ("Intent: " + foundIntent.Intent + "\n\n" + "Score: " + foundIntent.Score + "\n\n"); 
     } 
     await context.PostAsync(allIntents); 
     context.Wait(this.MessageReceived); 
    } 

そして、私のJSONは

{ 
    "query": "hey there", 
    "topScoringIntent": { 
    "intent": "None", 
    "score": 0.17292054 
    }, 
    "intents": [ 
    { 
     "intent": "None", 
     "score": 0.17292054 
    }, 
    { 
     "intent": "intentSearch", 
     "score": 0.122199811 
    }, 
    { 
     "intent": "fromIntent", 
     "score": 0.0327471271 
    }, 
    { 
     "intent": "goWithIntent", 
     "score": 0.010828237 
    } 
    ], 
    "entities": [] 
} 

のようなもので、そのスコア。ダイアログ内にすべてのインテントを返す方法はありますか?

EDIT:答えは何とか新しいプロジェクトに取り組んで、あなたはそうのようなあなたのLuisModelAttribute trueに冗長フラグを設定する必要がなぜ

答えて

5

わからない。:

[LuisModel("e7a9c2d5-0b92-47d3-9d73-xxxxxxxxxxxx", 
"4941fa348c49494db1e8e8xxxxxxxxxx", Verbose = true)] 

このあなたは、私がこのような結果を得た。このコードを使用して

[LuisIntent("greeting")] 
    public async Task Greeting(IDialogContext context, LuisResult result) 
    { 
     string allIntents = ""; 
     //Loop throught all intents found in JSON 
     foreach (var foundIntent in result.Intents) 
     { 
      allIntents += ("Intent: " + foundIntent.Intent + "\n\n" + "Score: " + foundIntent.Score + "\n\n"); 
     } 
     await context.PostAsync(allIntents); 

     context.Wait(this.MessageReceived); 
    } 

からあなたのスコアを取得することができ、すべての意図を取得するコードは、次のとおりです。 enter image description here

+0

私はちょうど '冗長= true'を設定するが、それは私の編集は、あなたのために働く場合も、同じ – yfan183

+0

は – JasonSowers

+0

そのコードは私が使用していることとまったく同じではないです見るまだありますか? – yfan183

関連する問題