public async Task Color(IDialogContext context, IAwaitable <IMessageActivity> activity, LuisResult result) { string ans = ""; string ent = "it"; QureyController qc = new QureyController(); qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0"); if (result.Entities != null && result.Entities.Count > 0) { ent = result.Entities[0].Entity; } string[] matching_words = { "blue", "your", "favourite", "like", "love" }; if (FindMatchingString.findMatchingString(result.Query, matching_words)) { ans = "Well blue is my favourite color. But i also like other colors.. :) "; } else { string[] listAns = { ent + "is interesting color but my favourite one is blue :)", "I don't find " + ent + " colorfull enough xD", "Well " + ent + " is interesting color but not as my favourite ;)", "Yea i like " + ent + " too :) " }; Random rand = new Random(); ans = listAns[rand.Next(0, listAns.Length)]; } qc.PostAnswerOne(ans, result.TopScoringIntent.Intent); await context.PostAsync(ans); context.Wait(MessageReceived); }
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 WhoIsYou(IDialogContext context, IAwaitable <IMessageActivity> activity, LuisResult result) { QureyController qc = new QureyController(); qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0"); if (result.TopScoringIntent.Score < 0.4) { string ans = ""; ans = qc.GetTrainedAnswer(result.Query); qc.PostAnswerOne(ans, result.TopScoringIntent.Intent); await context.PostAsync(ans); context.Wait(MessageReceived); } else { string ans = ""; string[] matching_words = { "yourself", "robot", "human", "created" }; string[] matching_words1 = { "doing" }; if (FindMatchingString.findMatchingString(result.Query, matching_words)) { ans = "Well I am created out of 0 and 1. I can not say for myself that I'm a human but am I a robot? Huh. I can just say that I was created in good spirit to help you, that's all :) "; } else if (FindMatchingString.findMatchingString(result.Query, matching_words1)) { ans = "All I can say is that I'm created for your purpose."; } else { string[] listAns = { "Like you already know, my name is Arnie and I'm a chat bot, you can ask me some interesting question :)", "Arnie is my name and my purpose is to help you waste your time ;)" }; Random rand = new Random(); ans = listAns[rand.Next(0, listAns.Length)]; } await context.PostAsync(ans); qc.PostAnswerOne(ans, result.TopScoringIntent.Intent); context.Wait(MessageReceived); } }
public async Task BadLanguage(IDialogContext context, IAwaitable <IMessageActivity> activity, 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.4) { ans = qc.GetTrainedAnswer(result.Query); await context.PostAsync(ans); context.Wait(MessageReceived); qc.PostAnswerOne(ans, result.TopScoringIntent.Intent); } else { string[] matching_words = { "suck", "rude", "bad", "created", "like" }; if (FindMatchingString.findMatchingString(result.Query, matching_words)) { ans = "I'm so sorry to hear that. Well I'm still developing, give me a chance... :) "; } else { string[] listAns = { "You should not speak like that", "That's not good.", "You should take a deep breath and clear your mind and start again :)", "Maybe to try something else or some other comment :)" }; Random rand = new Random(); ans = listAns[rand.Next(0, listAns.Length)]; } qc.PostAnswerOne(ans, result.TopScoringIntent.Intent); await context.PostAsync(ans); context.Wait(MessageReceived); } }
public async Task No(IDialogContext context, LuisResult result) { QureyController qc = new QureyController(); qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0"); if (result.TopScoringIntent.Score < 0.3) { string ans = ""; ans = qc.GetTrainedAnswer(result.Query); qc.PostAnswerOne(ans, result.TopScoringIntent.Intent); await context.PostAsync(ans); context.Wait(MessageReceived); } else { string[] matching_words = { "nothing" }; string ans = ""; string[] listAns = { "Oh ok..", "Well..ok.", "Ok, human.", "I did not expect that." }; if (FindMatchingString.findMatchingString(result.Query, matching_words)) { listAns = new string[] { "Let yourself experience how nothing feels.", "Often under nothingness is great depth", "I invite you to rest in nothingness" }; } Random random = new Random(); int rand = random.Next(0, listAns.Length); ans = listAns[rand]; qc.PostAnswerOne(ans, result.TopScoringIntent.Intent); await context.PostAsync(ans); context.Wait(MessageReceived); } }
public async Task Yes(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); qc.PostAnswerOne(ans, result.TopScoringIntent.Intent); await context.PostAsync(ans); context.Wait(MessageReceived); } else { string[] matching_words = { "everything" }; string[] listAns = { "Yes is what i like to hear.", "That's the spirit.", "Yes is always the right answer." }; if (FindMatchingString.findMatchingString(result.Query, matching_words)) { listAns = new string[] { "We should talk more often", "Ohh.. ok." }; } Random random = new Random(); int rand = random.Next(0, listAns.Length); ans = listAns[rand]; await context.PostAsync(ans); context.Wait(MessageReceived); qc.PostAnswerOne(ans, result.TopScoringIntent.Intent); } }
public async Task Greetigns(IDialogContext context, IAwaitable <IMessageActivity> message, LuisResult result) { QureyController qc = new QureyController(); if (result.TopScoringIntent.Score < 0.4) { string ans = ""; ans = qc.GetTrainedAnswer(result.Query); qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0"); qc.PostAnswerOne(ans, result.TopScoringIntent.Intent); await context.PostAsync(ans); context.Wait(MessageReceived); } else { string[] listAns1 = { "Well hello there, how are you today?", "Hello, how are you?", "Hellloooo... What's up?" }; string[] listAns2 = { "I'm relaxing, what about you?", "Nothing much, what about you?", "Just chillin... :) " }; string[] listAns3 = { "I'm fine thank you, what about you?", "I'm doing great", "Great, what about you?", "Fine, what about you :)" }; string ans = ""; Random rand = new Random(); bool found = false; string[] matching_words1 = { "hello", "yo", "hi", "helo", "Greetings" }; string[] matching_words2 = { "what", "doing" }; string[] matching_words3 = { "how" }; if (FindMatchingString.findMatchingString(result.Query, matching_words1)) { ans = listAns1[rand.Next(0, listAns1.Length)]; found = true; } else if (FindMatchingString.findMatchingString(result.Query, matching_words2)) { ans = listAns2[rand.Next(0, listAns2.Length)]; found = true; } else if (FindMatchingString.findMatchingString(result.Query, matching_words3)) { ans = listAns3[rand.Next(0, listAns3.Length)]; found = true; } else { ans = qc.GetTrainedAnswer(result.Query); if (ans.Length > 0) { found = true; } } if (!found) { ans = "Greetins to you :)"; } qc.PostQuestionOne(result.Query, result.TopScoringIntent.Intent, result.TopScoringIntent.Score.ToString(), "0"); qc.PostAnswerOne(ans, result.TopScoringIntent.Intent); await context.PostAsync(ans); context.Wait(MessageReceived); } }