public bool?RecognizeEntity(IMessageActivity messageActivity) { var yesKey = PromptDialog.PromptConfirm.Yes.ToString(CultureInfo.InvariantCulture); var noKey = PromptDialog.PromptConfirm.No.ToString(CultureInfo.InvariantCulture); var choices = new Dictionary <string, IReadOnlyList <string> > { { yesKey, this.patterns[PromptDialog.PromptConfirm.Yes].Select(x => x.ToLowerInvariant()) .ToList() }, { noKey, this.patterns[PromptDialog.PromptConfirm.No].Select(x => x.ToLowerInvariant()) .ToList() } }; var promptRecognizer = new PromptRecognizer(); var entityMatches = promptRecognizer.RecognizeChoices(messageActivity, choices); var entityWinner = entityMatches.MaxBy(x => x.Score) ?? new RecognizeEntity <string>(); return(entityWinner.Entity == yesKey ? true : (entityWinner.Entity == noKey ? (bool?)false : null)); }