Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // <auto-generated>
- // Code generated by LUISGen .\MainIntents.json -cs Luis.MainIntents -o .
- // Tool github: https://github.com/microsoft/botbuilder-tools
- // Changes may cause incorrect behavior and will be lost if the code is
- // regenerated.
- // </auto-generated>
- using Newtonsoft.Json;
- using System.Collections.Generic;
- using Microsoft.Bot.Builder;
- using Microsoft.Bot.Builder.AI.Luis;
- namespace myNamedBot.CognitiveModels
- {
- public partial class MainIntents : IRecognizerConvert
- {
- public string Text;
- public string AlteredText;
- public enum Intent
- {
- PassportLost,
- None
- };
- public Dictionary<Intent, IntentScore> Intents;
- [JsonExtensionData(ReadData = true, WriteData = true)]
- public IDictionary<string, object> Properties { get; set; }
- public void Convert(dynamic result)
- {
- var app = JsonConvert.DeserializeObject<MainIntents>(JsonConvert.SerializeObject(result, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }));
- Text = app.Text;
- AlteredText = app.AlteredText;
- Intents = app.Intents;
- Properties = app.Properties;
- }
- public (Intent intent, double score) TopIntent()
- {
- Intent maxIntent = Intent.None;
- var max = 0.0;
- foreach (var entry in Intents)
- {
- if (entry.Value.Score > max)
- {
- maxIntent = entry.Key;
- max = entry.Value.Score.Value;
- }
- }
- return (maxIntent, max);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement