private void sent_but_Click(object sender, RoutedEventArgs e)
        {
            SentimentPrediction resultprediction = SentimentAnalyzer.predict(sent_input.Text);
            String txt = $"Text: {sent_input.Text} | Prediction: {(Convert.ToBoolean(resultprediction.Prediction) ? "Toxic" : "Non Toxic")} sentiment | Probability of being toxic: {resultprediction.Probability} ";

            sent_output.Text += txt + Environment.NewLine;
        }
Exemple #2
0
        public String analyzeMsg_withSentiment(string m)
        {
            String result        = "";
            int    target_player = 0;

            if (m.Contains("P1") && !m.Contains("P2"))
            {
                target_player = 1;
            }
            else if (m.Contains("P2") && !m.Contains("P1"))
            {
                target_player = 2;
            }
            if (target_player != 0)
            {
                SentimentPrediction resultprediction = SentimentAnalyzer.predict(m);
                Boolean             neg = Convert.ToBoolean(resultprediction.Prediction);
                if (neg)
                {
                    score_neg[0]++;
                    score_neg[target_player]++;
                }
                else
                {
                    score_pos[0]++;
                    score_pos[target_player]++;
                }
                updateVariables();
                result = $"  P{target_player} {(neg ? "-" : "+")} c={resultprediction.Probability}";
            }
            return(result);
        }