Пример #1
0
        public async Task ConfirmPreferencesIntent(IDialogContext context, LuisResult result)
        {
            if (confirmWait == true && setPreferencesClose == true && changePreferenceUnderstand == false)
            {
                if (result.Query.ToLower().Contains("yes"))
                {
                    string insert = InsertData.InsertIntoDbVlutation(entityScore, resultEntity, convID);

                    entityScore.Clear();

                    valuetedEntities.Clear();

                    entitiesPreferences.Clear();

                    typeCattured.Clear();

                    if (resultEntity != null)
                    {
                        resultEntity.Clear();
                    }

                    if (insert.Equals("ok"))
                    {
                        await context.PostAsync("Perfect, I Understand!");
                    }
                    else
                    {
                        await context.PostAsync($"You have already evalueted {insert}");
                    }
                }
                else

                if (result.Query.ToLower().Contains("type wrong"))
                {
                    await context.PostAsync("Ok repeat again!");

                    entityScore.Clear();

                    valuetedEntities.Clear();

                    entitiesPreferences.Clear();

                    typeCattured.Clear();

                    if (resultEntity != null)
                    {
                        resultEntity.Clear();
                    }
                }
                else

                if (result.Query.ToLower().Contains("no"))
                {
                    Dictionary <EntityRecommendation, double?> .Enumerator e = entityScore.GetEnumerator();
                    string understand = "I understand you ";
                    while (e.MoveNext())
                    {
                        if (!understand.Contains(e.Current.Key.Entity))
                        {
                            if (e.Current.Value > 0.5)
                            {
                                understand += "like ";
                            }
                            else
                            {
                                understand += "dislike ";
                            }

                            understand += e.Current.Key.Entity;

                            await context.PostAsync(understand);

                            understand = string.Empty;
                        }
                    }

                    changePreferenceUnderstand = true;
                    await context.PostAsync("Tell me what entity's preference wrong typing     'change [name entity]'   one at time please!'");
                }

                confirmWait = false;
            }
            else
            {
                await context.PostAsync(result.Query);
            }

            context.Wait(MessageReceived);
        }