예제 #1
0
        public bool CheckToxicityAsync(string message, int max)
        {
            if (Perspective == null)
            {
                return(false);
            }

            try
            {
                var res = Perspective.QueryToxicity(message);
                if (res.attributeScores.TOXICITY.summaryScore.value * 100 > max)
                {
                    return(true);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return(false);
        }