public async Task Music(IDialogContext context, LuisResult result) { QureyController qc = new QureyController(); string ans = ""; qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0"); if (result.TopScoringIntent.Score < 0.3) { ans = qc.GetTrainedAnswer(result.Query); await context.PostAsync(ans); qc.PostAnswerOne(ans, result.TopScoringIntent.Intent); context.Wait(MessageReceived); } else { bool found = false; string[] matching_words1 = { "like" }; string[] matching_words2 = { "make", "create", "play" }; string[] matching_words3 = { "you" }; string tr_ans = qc.GetTrainedAnswer(result.Query); if (!string.IsNullOrEmpty(tr_ans)) { ans = tr_ans; found = true; } else if (FindMatchingString.findMatchingString(result.Query, matching_words1)) { ans = "Well I can say that I do :D "; found = true; } else if (FindMatchingString.findMatchingString(result.Query, matching_words2)) { ans = "Hmmm well listen to this... DO RE MI .... FA SO LAAAAAaaaaaaaa... How did that sound xD "; } else if (FindMatchingString.findMatchingString(result.Query, matching_words3)) { ans = "Well music is always fun. :) "; found = true; } else { var options = new MovieChoice[] { MovieChoice.PopularMovie, MovieChoice.SearchMovie }; var descriptions = new string[] { "Popular Movies", "Search for movie" }; PromptDialog.Choice <MovieChoice>(context, ResumeAfterMovieChoiceSelection, options, "What would you like to choose about movies?", descriptions: descriptions); } if (found) { await context.PostAsync(ans); context.Wait(MessageReceived); } qc.PostAnswerOne(ans, result.TopScoringIntent.Intent); context.Call(new BingWikiSearchDialog(), this.ResumeAfterOptionDialog); } }
public async Task Movies(IDialogContext context, LuisResult result) { QureyController qc = new QureyController(); string ans = ""; bool savedData = false; qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0"); if (result.TopScoringIntent.Score < 0.4) { ans = qc.GetTrainedAnswer(result.Query); savedData = true; } if (ans == "" || ans == "Hmmm ...") { ans = qc.GetAnswer(result.Query, "Movies", result.TopScoringIntent.Score.ToString(), "0"); savedData = true; } if (ans == "") { var options = new MovieChoice[] { MovieChoice.PopularMovie, MovieChoice.SearchMovie }; var descriptions = new string[] { "List Popular Movies", "Search for movie" }; PromptDialog.Choice <MovieChoice>(context, ResumeAfterMovieChoiceSelection, options, "What would you like to choose about movies?", descriptions: descriptions); } if (savedData) { qc.PostAnswerOne(ans, result.TopScoringIntent.Intent); savedData = false; await context.PostAsync(ans); context.Wait(MessageReceived); } }