Beispiel #1
0
def get_perspective_score(text):
    p = Perspective(API_KEY)
    try:
        comment = p.score(text, tests=["TOXICITY"])
        score = comment["TOXICITY"].score
    except:
        score = 0
    return score