public static void Predict(string text, PredictionEngine <SentimentIssue, SentimentPrediction> predEngine) { var testSentiment = new SentimentIssue { Text = text }; var resultprediction = predEngine.Predict(testSentiment); Console.WriteLine($"Text: {testSentiment.Text} | Prediction: {(Convert.ToBoolean(resultprediction.Prediction) ? "Toxic" : "Good")} | Probability of being toxic: {resultprediction.Probability} "); }
public static void Predict(string text, PredictionEngine <SentimentIssue, SentimentPrediction> predEngine) { // prediction var testSentiment = new SentimentIssue { Text = text }; var prediction = predEngine.Predict(testSentiment); // Console Write Console.ForegroundColor = ConsoleColor.White; Console.WriteLine($"Text: {testSentiment.Text}"); Console.ForegroundColor = prediction.Prediction ? ConsoleColor.Red : ConsoleColor.Green; Console.WriteLine($" Prediction: {(Convert.ToBoolean(prediction.Prediction) ? "Toxic" : "Good")} | Probability of being toxic: {prediction.Probability} "); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; }