make luisrecognizer only return topintent

This commit is contained in:
Tom Laird-McConnell 2019-04-06 17:29:56 -07:00
Родитель 42010cac9a
Коммит 63ed0c73ee
2 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -288,7 +288,8 @@ namespace Microsoft.Bot.Builder.AI.Luis
{
Text = utterance,
AlteredText = luisResult.AlteredQuery,
Intents = LuisUtil.GetIntents(luisResult),
//Intents = LuisUtil.GetIntents(luisResult), return only top intent
Intents = new Dictionary<string, IntentScore>() { { luisResult.TopScoringIntent.Intent, new IntentScore() { Score = luisResult.TopScoringIntent.Score } } },
Entities = LuisUtil.ExtractEntitiesAndMetadata(luisResult.Entities, luisResult.CompositeEntities, _options.IncludeInstanceData ?? true),
};
LuisUtil.AddProperties(luisResult, recognizerResult);

Просмотреть файл

@ -38,7 +38,7 @@ namespace Microsoft.Bot.Builder
/// Mapping from intent to information about the intent.
/// </value>
[JsonProperty("intents")]
public IDictionary<string, IntentScore> Intents { get; set; }
public IDictionary<string, IntentScore> Intents { get; set; } = new Dictionary<string, IntentScore>();
/// <summary>
/// Gets or sets the recognized top-level entities.
@ -47,7 +47,7 @@ namespace Microsoft.Bot.Builder
/// Object with each top-level recognized entity as a key.
/// </value>
[JsonProperty("entities")]
public JObject Entities { get; set; }
public JObject Entities { get; set; } = new JObject();
/// <summary>
/// Gets or sets properties that are not otherwise defined by the <see cref="RecognizerResult"/> type but that