private static bool C([NotNull] string input) { var extr = FuzzyParsing.BooleanChoice(input); Console.WriteLine($"{input} : {extr.Value} ({extr.Confidence})"); return(extr.Value); }
public async Task MaybeCat() { var real = _roll.Flip(); var stream = await(real ? _cats.GetCatPictureAsync() : _mlcats.GetCatPictureAsync()); stream.Seek(0, SeekOrigin.Begin); //Upload image await Context.Channel.SendFileAsync(stream, "this might be a cat.png"); await ReplyAsync("Is this a real cat or not?"); var next = await NextMessageAsync(true, true, TimeSpan.FromSeconds(10)); if (next == null) { await ReplyAsync("Too slow!"); } else { var choice = FuzzyParsing.BooleanChoice(next.Content); if (choice.Confidence < 0.5f) { await ReplyAsync("Sorry, I don't understand you :("); } else if (choice.Value == real) { await ReplyAsync("Correct!"); } else if (real) { await TypingReplyAsync("Wrong! This is a real kitty"); } else { await TypingReplyAsync("Wrong! This is a machine kitty"); } } }