コード例 #1
0
        public async Task Given_ManyLuisServices_When_GetResultWithStrongestTopScoringIntentIsCalled_Then_ResultWithStrongerTopScoringIntentIsReturned(string queryText)
        {
            // Arrange
            var request = new LuisRequest(queryText);
            var token   = CancellationToken.None;

            var luisServiceMock1 = new Mock <ILuisServiceWrapper>();

            luisServiceMock1.Setup(m => m.ModifyRequest(It.Is <LuisRequest>(lr => lr.Query == queryText))).Returns(request);
            var luisResult = new LuisResult(queryText, new List <EntityRecommendation>(), new IntentRecommendation("IntentA", score: 0.95));

            luisServiceMock1.Setup(m => m.QueryAsync(request, token)).ReturnsAsync(luisResult);

            var luisServiceMock2 = new Mock <ILuisServiceWrapper>();

            luisServiceMock2.Setup(m => m.ModifyRequest(It.Is <LuisRequest>(lr => lr.Query == queryText))).Returns(request);
            var strongerLuisResult = new LuisResult(queryText, new List <EntityRecommendation>(), new IntentRecommendation("IntentB", score: 0.96));

            luisServiceMock2.Setup(m => m.QueryAsync(request, token)).ReturnsAsync(strongerLuisResult);

            // Act
            var result = await LuisQueryHelper.GetResultWithStrongestTopScoringIntent(new[] { luisServiceMock1.Object, luisServiceMock2.Object }, queryText, token);

            // Assert
            result.Should().BeEquivalentTo(strongerLuisResult);
        }
コード例 #2
0
ファイル: Startup.cs プロジェクト: joescars/botbuilder-dotnet
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddBot <LuisTranslatorBot>(options =>
            {
                options.CredentialProvider = new ConfigurationCredentialProvider(Configuration);

                string luisModelId         = "<Your Model Here>";
                string luisSubscriptionKey = "<Your Key here>";
                Uri luisUri   = new Uri("https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/");
                var luisModel = new LuisModel(luisModelId, luisSubscriptionKey, luisUri);

                // If you want to get all intents scorings, add verbose in luisOptions
                var luisOptions = new LuisRequest {
                    Verbose = true
                };
                Dictionary <string, List <string> > patterns = new Dictionary <string, List <string> >();
                patterns.Add("fr", new List <string> {
                    "mon nom est (.+)"
                });                                                     //single pattern for fr language
                var middleware = options.Middleware;
                middleware.Add(new ConversationState <CurrentUserState>(new MemoryStorage()));
                middleware.Add(new TranslationMiddleware(new string[] { "en" }, "<your translator key here>", patterns, TranslatorLocaleHelper.GetActiveLanguage, TranslatorLocaleHelper.CheckUserChangedLanguage));
                middleware.Add(new LocaleConverterMiddleware(TranslatorLocaleHelper.GetActiveLocale, TranslatorLocaleHelper.CheckUserChangedLocale, "en-us", LocaleConverter.Converter));
                middleware.Add(new LuisRecognizerMiddleware(luisModel, luisOptions: luisOptions));
            });
        }
コード例 #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton(_ => Configuration);
            services.AddBot <LitwareRoot>(options =>
            {
                options.CredentialProvider = new ConfigurationCredentialProvider(Configuration);

                var luisOptions = new LuisRequest {
                    Verbose = true
                };
                options.Middleware.Add(new LuisRecognizerMiddleware(
                                           new LuisModel(
                                               "653f443e-da2d-43ee-ae47-8da7a836fc25",
                                               "be30825b782843dcbbe520ac5338f567",
                                               new Uri("https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/")), luisOptions: luisOptions));

                var qnamakerEndpoint = new QnAMakerEndpoint
                {
                    EndpointKey     = "d534abd71a0d438d95d5a001025ee074",
                    Host            = "https://westus.api.cognitive.microsoft.com/qnamaker/v2.0",
                    KnowledgeBaseId = "40080f40-0200-482e-8e55-fae74d973490"
                };
                var qnamakerOptions = new QnAMakerMiddlewareOptions
                {
                    EndActivityRoutingOnAnswer = true
                };
                options.Middleware.Add(new QnAMakerMiddleware(qnamakerEndpoint, qnamakerOptions));
            });
        }
コード例 #4
0
        public LuisRequest ModifyRequest(LuisRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            this.query = request.Query;
            return(request);
        }
コード例 #5
0
        /// <inheritdoc />
        public Task <RecognizerResult> Recognize(string utterance, CancellationToken ct)
        {
            if (string.IsNullOrEmpty(utterance))
            {
                throw new ArgumentNullException(nameof(utterance));
            }

            var luisRequest = new LuisRequest(utterance);

            _luisOptions.Apply(luisRequest);
            return(Recognize(luisRequest, ct, _luisRecognizerOptions.Verbose));
        }
コード例 #6
0
        private async Task <RecognizerResult> Recognize(LuisRequest request, CancellationToken ct, bool verbose)
        {
            var luisResult = await _luisService.QueryAsync(request, ct).ConfigureAwait(false);

            var recognizerResult = new RecognizerResult
            {
                Text     = request.Query,
                Intents  = GetIntents(luisResult),
                Entities = GetEntitiesAndMetadata(luisResult.Entities, luisResult.CompositeEntities, verbose)
            };

            return(recognizerResult);
        }
コード例 #7
0
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            ILuisRequest    LuisAPI           = new LuisRequest();
            ILuisProcessing LuisAPIProcessing = new LuisProcessing();
            var             activity          = await result as Activity;

            var LuisResult = await MakeLuisCall(context, activity.Text, LuisAPI);

            var ProcessedLuisResult = await LuisAPIProcessing.DoProcessingComplex(context, LuisResult);

            if ((ProcessedLuisResult.Name_0 == "") && (ProcessedLuisResult.Name_1 == ""))
            {
                context.Wait(MessageReceivedAsync);
            }
            else
            {
                var QnAAnswer = await MakeNameQnAMakerCall(context, ProcessedLuisResult);

                if (QnAAnswer[0].Score < 0.2)
                {
                    await context.PostAsync("I am sorry I could not find the name " + ProcessedLuisResult.Name_0 + " in my Database");

                    context.Wait(MessageReceivedAsync);
                }
                else if (QnAAnswer[1].Score < 0.2)
                {
                    await context.PostAsync("I am sorry I could not find the name " + ProcessedLuisResult.Name_1 + " in my Database");

                    context.Wait(MessageReceivedAsync);
                }
                else if ((QnAAnswer[1].Score < 0.2) && (QnAAnswer[0].Score < 0.2))
                {
                    await context.PostAsync("I am sorry I could not find neither name "
                                            + ProcessedLuisResult.Name_0 + " nor the name "
                                            + ProcessedLuisResult.Name_0 + " in my Database");

                    context.Wait(MessageReceivedAsync);
                }
                else
                {
                    JObject StarwarsAnswer1 = await CallStarWarsApi(context, QnAAnswer[0].Answer);

                    JObject StarwarsAnswer2 = await CallStarWarsApi(context, QnAAnswer[1].Answer);

                    await ProcessAndPostToUser(context, ProcessedLuisResult, StarwarsAnswer1, StarwarsAnswer2);

                    context.Wait(MessageReceivedAsync);
                }
            }
        }
コード例 #8
0
ファイル: DictationToLUIS.cs プロジェクト: ashanhol/LUISMR
        private void Awake()
        {
            LUIS        = gameObject.GetComponent <LuisRequest>();
            IsRecording = false;
            // Query the maximum frequency of the default microphone.
            int minSamplingRate; // Not used.

            Microphone.GetDeviceCaps(DeviceName, out minSamplingRate, out samplingRate);

            dictationRecognizer = new DictationRecognizer();
            dictationRecognizer.DictationHypothesis += DictationRecognizer_DictationHypothesis;
            dictationRecognizer.DictationResult     += DictationRecognizer_DictationResult;
            dictationRecognizer.DictationComplete   += DictationRecognizer_DictationComplete;
            dictationRecognizer.DictationError      += DictationRecognizer_DictationError;
        }
コード例 #9
0
        public async Task None(IDialogContext context, LuisRequest result)
        {
            var options = "* Site Access \n" +
                          "* Site Creation \n" +
                          "* Site Quota Change \n" +
                          "* External User Access \n" +
                          "* Profile Updates \n" +
                          "* Knowledge Base Article \n";

            await context.PostAsync("Sorry, I am unable to understand you. Let us start over." +
                                    "\r\r" + options +
                                    "\r\r Please type your question in the space provided below.");

            context.Wait(MessageReceived);
        }
コード例 #10
0
ファイル: Startup.cs プロジェクト: angelobelchior/VSSummitBot
 // This method gets called by the runtime. Use this method to add services to the container.
 // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddSingleton(Configuration);
     services.AddBot <BotHandler>(options =>
     {
         options.CredentialProvider = new ConfigurationCredentialProvider(Configuration);
         string luisModelId         = "863ba937-e630-419c-9db6-358d78ed5f65";
         string luisSubscriptionKey = "30a9eba1e3684f75a8ed830939fca32a";
         Uri luisUri     = new Uri("https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/");
         var luisModel   = new LuisModel(luisModelId, luisSubscriptionKey, luisUri);
         var luisOptions = new LuisRequest {
             Verbose = true, Staging = true
         };
         var middleware = options.Middleware;
         middleware.Add(new LuisRecognizerMiddleware(luisModel, luisOptions: luisOptions));
     });
 }
コード例 #11
0
        protected virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> item)
        {
            var message     = await item;
            var luisRequest = new LuisRequest(query: message.Text, contextId: this.contextId);
            var result      = await luisService.QueryAsync(luisService.BuildUri(luisService.ModifyRequest(luisRequest)), context.CancellationToken);

            if (result.Dialog.Status != DialogResponse.DialogStatus.Finished)
            {
                this.contextId = result.Dialog.ContextId;
                this.prompt    = result.Dialog.Prompt;
                await context.PostAsync(this.prompt);

                context.Wait(MessageReceivedAsync);
            }
            else
            {
                context.Done(result);
            }
        }
コード例 #12
0
ファイル: Startup.cs プロジェクト: seosoft/Cogbot16_201808
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddBot <TaskBot>(options =>
            {
                options.CredentialProvider = new ConfigurationCredentialProvider(Configuration);

                options.Middleware.Add(new CatchExceptionMiddleware <Exception>(async(context, exception) =>
                {
                    await context.TraceActivity("EchoBot Exception", exception);
                    await context.SendActivity("Sorry, it looks like something went wrong!");
                }));

                var luisModel   = GetLuisModel(Configuration, "Task");
                var luisOptions = new LuisRequest {
                    Verbose = true
                };
                options.Middleware.Add(new LuisRecognizerMiddleware(luisModel, luisOptions: luisOptions));
            });
        }
コード例 #13
0
ファイル: Startup.cs プロジェクト: hieumoscow/dbot
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton(this.Configuration);
            services.AddBot <LuisDispatchBot>(options =>
            {
                options.CredentialProvider = new ConfigurationCredentialProvider(Configuration);

                var(luisModelId, luisSubscriptionKey, luisUri) = GetLuisConfiguration(this.Configuration, "Dispatcher");

                var luisModel = new LuisModel(luisModelId, luisSubscriptionKey, luisUri);

                // If you want to get all intents scorings, add verbose in luisOptions
                var luisOptions = new LuisRequest {
                    Verbose = true
                };

                var middleware = options.Middleware;
                middleware.Add(new LuisRecognizerMiddleware(luisModel, luisOptions: luisOptions));
            });
        }
コード例 #14
0
ファイル: Startup.cs プロジェクト: onebluecube/build2018demo
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton(_ => Configuration);
            services.AddBot <HelloBot>(options =>
            {
                options.CredentialProvider = new ConfigurationCredentialProvider(Configuration);
                // If you want to get all intents scorings, add verbose in luisOptions

                /*var luisOptions = new LuisRequest { Verbose = true };
                 * options.Middleware.Add(new LuisRecognizerMiddleware(
                 *  new LuisModel(
                 *      "586c6eba-c656-4a86-adc5-b963769bbaed",
                 *      "be30825b782843dcbbe520ac5338f567",
                 *      new Uri("https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/")), luisOptions: luisOptions));
                 *
                 * options.Middleware.Add(new QnAMakerMiddleware(
                 *              new QnAMakerMiddlewareOptions()
                 *              {
                 *                  SubscriptionKey = "d534abd71a0d438d95d5a001025ee074",
                 *                  KnowledgeBaseId = "40080f40-0200-482e-8e55-fae74d973490",
                 *                  EndActivityRoutingOnAnswer = true
                 *              }));*/

                var luisOptions = new LuisRequest {
                    Verbose = true
                };
                options.Middleware.Add(new LuisRecognizerMiddleware(
                                           new LuisModel(
                                               "653f443e-da2d-43ee-ae47-8da7a836fc25",
                                               "be30825b782843dcbbe520ac5338f567",
                                               new Uri("https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/")), luisOptions: luisOptions));

                options.Middleware.Add(new QnAMakerMiddleware(
                                           new QnAMakerMiddlewareOptions()
                {
                    SubscriptionKey            = "d534abd71a0d438d95d5a001025ee074",
                    KnowledgeBaseId            = "40080f40-0200-482e-8e55-fae74d973490",
                    EndActivityRoutingOnAnswer = true
                }));
            });
        }
コード例 #15
0
ファイル: Startup.cs プロジェクト: spgregory/BOTDevelopmentV4
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddBot <LuisBot>(options =>
            {
                options.CredentialProvider = new ConfigurationCredentialProvider(Configuration);

                string luisModelId         = "";
                string luisSubscriptionKey = "";
                Uri luisUri = new Uri("https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/");

                var luisModel = new LuisModel(luisModelId, luisSubscriptionKey, luisUri);

                // If you want to get all intents scorings, add verbose in luisOptions
                var luisOptions = new LuisRequest {
                    Verbose = true
                };

                var middleware = options.Middleware;
                middleware.Add(new LuisRecognizerMiddleware(luisModel, luisOptions: luisOptions));
            });
        }
コード例 #16
0
            private Task <T> ProcessRequestAsync <T>(object arg0, object arg1 = null, object arg2 = null, [CallerMemberName] string methodName = null)
            {
                var request = new LuisRequest
                {
                    Method    = methodName,
                    Arguments = new[] { arg0, arg1, arg2 },
                };

                this.RequestsInternal.Add(Timestamped.Create(request));

                this.OnRequest?.Invoke(request);

                var response = this.OnRequestResponse?.Invoke(request);

                if (response == null && IsTrainingStatusRequest(request))
                {
                    response = Array.Empty <ModelTrainingInfo>();
                }

                return(Task.FromResult((T)response));
            }
コード例 #17
0
        public static ILuisService MakeMockedLuisService(ILuisModel model)
        {
            var mock    = new Mock <ILuisService>(MockBehavior.Strict);
            var request = new LuisRequest(query: UtteranceSetAlarm);

            var uri = request.BuildUri(model);

            mock
            .Setup(l => l.BuildUri(It.IsAny <LuisRequest>()))
            .Returns <LuisRequest>(r => ((ILuisService) new LuisService(model)).BuildUri(r));

            mock
            .Setup(l => l.ModifyRequest(It.IsAny <LuisRequest>()))
            .Returns <LuisRequest>(r => r);

            mock
            .Setup(l => l.QueryAsync(It.Is <Uri>(u => u == uri), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new LuisResult()
            {
                Intents = new[]
                {
                    new IntentRecommendation()
                    {
                        Intent = ExampleBot.IntentSetAlarm.IntentName,
                        Score  = 1.0
                    }
                },
                Entities = Array.Empty <EntityModel>(),
            });

            mock
            .Setup(l => l.QueryAsync(It.Is <Uri>(u => u != uri), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new LuisResult()
            {
                Intents  = Array.Empty <IntentRecommendation>(),
                Entities = Array.Empty <EntityModel>(),
            });

            return(mock.Object);
        }
コード例 #18
0
        public async Task UserAuthorization(IDialogContext context, LuisRequest result)
        {
            //context.Call(new SiteAccessDialog(),SiteAccessCallback);
            //var siteAccess = new FormDialog<SiteAccessDialog>(new SiteAccessDialog(),
            //    this.AuthorizeUser, FormOptions.PromptInStart);

            //context.Call<SiteAccessDialog>(siteAccess, SiteAccessCallback);

            try
            {
                await context.PostAsync("Weclome to SPOAssistant Site Access");

                var spoForm = new FormDialog <SPOAssistant>(new SPOAssistant(), SPOAssistant.BuildForm, FormOptions.PromptInStart);
                context.Call(spoForm, SPOAssistantFormComplete);
            }
            catch (Exception)
            {
                await context.PostAsync("Something really bad happened. You can try again later meanwhile I'll check what went wrong.");

                context.Wait(MessageReceived);
            }
        }
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            var activity = await result as Activity;

            ILuisRequest      LuisAPI     = new LuisRequest();
            IQnAMakerRequests QnAMakerAPI = new QnAMakerRequests();

            string KnowledgeBaseId = KeysAndRessourceStrings.KnowledgeBaseIdQuestions;
            string SubscriptionKey = KeysAndRessourceStrings.SubscriptionKeyQnAMaker;

            QnAMakerResult QnAMakerResultObject = await QnAMakerAPI.GetQnAMakerResponse(activity.Text,
                                                                                        KnowledgeBaseId, SubscriptionKey);

            JObject LuisResult = await MakeLuisCall(context, activity.Text, LuisAPI);

            if (await LuisQnADecision(QnAMakerResultObject, LuisResult))
            {
                await LuisCallProcess(context, result, LuisResult);
            }
            else
            {
                await QnACallProcess(context, result, activity.Text, QnAMakerResultObject);
            }
        }
コード例 #20
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton(_ => Configuration);
            services.AddBot <MainBot>(options =>
            {
                options.CredentialProvider = new ConfigurationCredentialProvider(Configuration);

                var middleware = options.Middleware;

                // Add middleware to send an appropriate message to the user if an exception occurs
                middleware.Add(new CatchExceptionMiddleware <Exception>(async(context, exception) =>
                {
                    //await context.SendActivity($"Sorry, it looks like something went wrong! {exception.Message}");
                }));

                middleware.Add(new ConversationState <ConversationData>(new MemoryStorage()));

                middleware.Add(new ShowTypingMiddleware());

                var luisModelId         = Configuration["LuisModelId"];
                var luisSubscriptionKey = Configuration["LuisSubscriptionKey"];
                var luisUri             = new Uri("https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/");

                var luisModel = new LuisModel(luisModelId, luisSubscriptionKey, luisUri);

                // If you want to get all intents scorings, add verbose in luisOptions
                var luisOptions = new LuisRequest {
                    Verbose = true
                };

                middleware.Add(new LuisRecognizerMiddleware(luisModel, luisOptions: luisOptions));

                //var defaultConnection =
                //    Configuration["ConnectionStrings:DefaultConnection"];
            });
        }
コード例 #21
0
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            var activity = await result as Activity;

            ILuisRequest    LuisAPI           = new LuisRequest();
            ILuisProcessing LuisAPIProcessing = new LuisProcessing();

            JObject LuisResult = await MakeLuisCall(context, activity.Text, LuisAPI);

            TransferObjectLuis ProcessedLuisResult = await LuisAPIProcessing.DoProcessing(context, LuisResult);

            if (String.IsNullOrEmpty(ProcessedLuisResult.Name_0))
            {
                await context.PostAsync("There is no droid you are looking for.");

                context.Wait(MessageReceivedAsync);
            }
            else
            {
                var QnAAnswer = await MakeQnAMakerCallforConversion(context, ProcessedLuisResult.Name_0);

                if (QnAAnswer.Score < 0.2)
                {
                    await context.PostAsync($"I am sorry I could not find the name {ProcessedLuisResult.Name_0} in my Database");

                    context.Wait(MessageReceivedAsync);
                }
                else
                {
                    JObject StarwarsAnswer = await CallStarWarsApi(context, QnAAnswer.Answer);
                    await ProcessAndPostToUser(context, ProcessedLuisResult, StarwarsAnswer);

                    context.Wait(MessageReceivedAsync);
                }
            }
        }
コード例 #22
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            //services.AddBot<EchoBot>(options =>
            //{
            //    options.CredentialProvider = new ConfigurationCredentialProvider(Configuration);


            //    options.Middleware.Add(new CatchExceptionMiddleware<Exception>(async (context, exception) =>
            //    {
            //        await context.TraceActivity("EchoBot Exception", exception);
            //        await context.SendActivity("Sorry, it looks like something went wrong!");
            //    }));


            //    IStorage dataStore = new MemoryStorage();

            //    options.Middleware.Add(new ConversationState<EchoState>(dataStore));
            //});

            services.AddBot <LuisDispatch>(options =>
            {
                options.CredentialProvider = new ConfigurationCredentialProvider(Configuration);
                options.Middleware.Add(new SentimentMiddleware(Configuration));
                var(luisModelId, luisSubscriptionKey, luisUri) = GetLuisConfiguration(this.Configuration, "Dispatcher");

                var luisModel = new LuisModel(luisModelId, luisSubscriptionKey, luisUri);

                // If you want to get all intents scorings, add verbose in luisOptions
                var luisOptions = new LuisRequest {
                    Verbose = true
                };

                var middleware = options.Middleware;
                middleware.Add(new LuisRecognizerMiddleware(luisModel, luisOptions: luisOptions));
            });
        }
コード例 #23
0
        public void ConfigureServices(IServiceCollection services)
        {
            var configurationBuilder = new ConfigurationBuilder()
                                       .SetBasePath(Env.ContentRootPath)
                                       .AddJsonFile("appsettings.json");

            var configuration = configurationBuilder
                                .Build();


            services.AddBot <Bot>((options) => {
                options.CredentialProvider = new ConfigurationCredentialProvider(configuration);

                var dispatcherConfiguration = Config.GetDispatchConfiguration(this.Configuration).Dispatcher;
                var luisModel   = new LuisModel(dispatcherConfiguration.Id, dispatcherConfiguration.Key, dispatcherConfiguration.Url);
                var luisOptions = new LuisRequest {
                    Verbose = true
                };

                options.Middleware.Add(new LuisRecognizerMiddleware(luisModel, luisOptions: luisOptions));
            });

            services.AddMvc();
        }
コード例 #24
0
        public async Task RoomReservation(IDialogContext context, LuisRequest result)
        {
            var enrollmentForm = new FormDialog <RoomReservation>(new RoomReservation(), this.ReserveRoom, FormOptions.PromptInStart);

            context.Call <RoomReservation>(enrollmentForm, CallBack);
        }
コード例 #25
0
 public Uri BuildUri(LuisRequest luisRequest)
 {
     return(BuildUri(luisRequest.Query));
 }
コード例 #26
0
 protected override LuisRequest ModifyLuisRequest(LuisRequest request)
 {
     request.ExtraParameters = "timezoneOffset=" + this.TimezoneOffset?.TotalMinutes.ToString();
     return(request);
 }
コード例 #27
0
 public LuisRequest ModifyRequest(LuisRequest request)
 {
     return(request);
 }
コード例 #28
0
 //modify Luis request to make it return all intents instead of just the topscoring intent
 protected override LuisRequest ModifyLuisRequest(LuisRequest request)
 {
     request.Verbose = true;
     return(request);
 }
コード例 #29
0
 /// <summary>
 /// Modify LUIS request before it is sent.
 /// </summary>
 /// <param name="request">Request so far.</param>
 /// <returns>Modified request.</returns>
 protected virtual LuisRequest ModifyLuisRequest(LuisRequest request)
 {
     return(request);
 }
コード例 #30
0
 protected override LuisRequest ModifyLuisRequest(LuisRequest request)
 {
     request.Query = Regex.Replace(request.Query, @"[""']", "");
     return(base.ModifyLuisRequest(request));
 }