예제 #1
0
        private async Task ProcessLuisResultsAsync(IDialogContext context, LuisResult result)
        {
            bool             closeToSec;
            string           secondIntention = null;
            EDegreeOfCertain degreeOfCertain = GetDegreeOfCertain(result);

            closeToSec = CloseToSecond(result);
            if (degreeOfCertain == EDegreeOfCertain.High)
            {
                if (CommonDialog.debugMessages)
                {
                    await context.PostAsync($"I understand that you {humanFriendlyIntent[subsIntention].Item1}");
                }
                context.Done(Tuple.Create(initialPhrase, humanFriendlyIntent[subsIntention].Item2));
            }
            else if (degreeOfCertain == EDegreeOfCertain.Medium)
            {
                nonUnderstoodUtterance = initialPhrase;
                if (closeToSec)
                {
                    secondIntention = ObtainSecondMostLikelyIntent(result);
                }
                await DoubleCheck(context, subsIntention, secondIntention);
            }
            else
            {
                await AskToRephraseAsync(context, result);
            }
        }
예제 #2
0
        public async Task None(IDialogContext context, LuisResult result)
        {
            string typosWarning = TyposInformation(result);
            bool   typos        = typosWarning != null;
            double score        = ObtainTopIntentScore(result);

            if (justCheck4Errors)
            {
                CheckSpelling(context, result);
                return;
            }

            EDegreeOfCertain degreeOfCertain = GetDegreeOfCertain(result);

            if (typos)
            {
                await context.PostAsync(typosWarning);

                initialPhrase = result.AlteredQuery;
            }
            else
            {
                initialPhrase = result.Query;
            }
            await this.PostDebugInfoAsync(context, result, "No intention");

            await Miscellany.InsertDelayAsync(context);

            await context.PostAsync($"I'm sorry. I didn’t understand how I can help you. I can help you to **upgrade your phone**, to **change your plan** or **both**. I’ll be here whenever you type something new and we can start again.");

            context.Done(Tuple.Create(initialPhrase, EIntent.None));
        }