コード例 #1
0
        private string TyposInformation(LuisResult result)
        {
            string correctedQuery;

            if (result.AlteredQuery == null)
            {
                return(null);
            }
            correctedQuery = Miscellany.QueryCompare(result.Query, result.AlteredQuery);
            return($"You typed \"{result.Query}\", did you mean \"{correctedQuery}\"?");
        }
コード例 #2
0
        private async Task BrandAndModelReceivedAsync(IDialogContext context, IAwaitable <object> awaitable)
        {
            List <string> brandsWanted = null,
                          modelsWanted = null;
            StringBuilder                         stringBuilder = new StringBuilder("Brands : ");
            Dictionary <string, bool>             brandsSet     = null;
            Dictionary <string, bool>             modelsSet;
            Tuple <string, NodeLUISBegin.EIntent> result = (Tuple <string, NodeLUISBegin.EIntent>)(await awaitable);
            string fullSentence;

            if (debugMessages)
            {
                await context.PostAsync("Beginning of BrandAndModelReceivedAsync()");
            }

            if (result.Item2 != NodeLUISBegin.EIntent.None)
            {
                string[] temp = result.Item1.Split(':');

                fullSentence = temp[1];
                await Miscellany.InsertDelayAsync(context);

                await context.PostAsync($"You typed \"{temp[0]}\", did you mean \"{Miscellany.QueryCompare(temp[0],fullSentence)}\"?");
            }
            else
            {
                fullSentence = result.Item1;
            }
            try
            {
                brandsSet = GetAllBrands();
            }
            catch (Exception xception)
            {
                await context.PostAsync("Error... xception message = " + xception.Message);
            }
            modelsSet = GetBrandModels(null);
            try
            {
                brandsWanted = FindBrandOccurrences(fullSentence, brandsSet);
                modelsWanted = FindModelOccurrences(fullSentence, modelsSet);
            }
            catch (Exception xception)
            {
                await context.PostAsync($"Exception message = {xception.Message}");
            }

            await ProcessSelectedBrandsAndModels(context, brandsWanted, modelsWanted, true);
        }