public Bot(IConfiguration config, ConversationState state, ILoggerFactory loggerFactory) : base(state, new BotServices(config), loggerFactory, null) { LuisServiceDefinition lsd = JsonConvert.DeserializeObject <LuisServiceDefinition>(LUISConfig); // Use LSD and no spell checking _classifier = new LuisClassifier(lsd, false); LoadIntentHandlers(); }
/// <summary> /// Creates the analyzer. /// </summary> /// <param name="config">The configuration of the bot</param> /// <param name="lang">Defines the language.</param> /// <param name="threshold">The default threshold for Luis classification.</param> /// <exception cref="ArgumentException">unsupported language.</exception> public LUISQuestionAnalyzer(IConfiguration config, Language lang, double threshold) { if (!Configs.ContainsKey(lang)) { throw new ArgumentException("Your Language is not supported."); } var map = config.GetSection("QuestionAnalyzer").GetSection(Configs[lang]).Get <Dictionary <string, object> >(); LuisServiceDefinition lsd = JsonConvert.DeserializeObject <LuisServiceDefinition>(JsonConvert.SerializeObject(map)); _classifier = new LuisRecognizer( new LuisRecognizerOptionsV2(new LuisApplication(lsd.GetLuisService())) { PredictionOptions = lsd.GetPredictOpts() } ); _threshold = threshold; }