Find “Toxicity/Profanity” of a comment using Google Perspective

sandeshsuvarna

Sandesh B Suvarna (Iconic.wtf)

Posted on November 16, 2018

Find “Toxicity/Profanity” of a comment using Google Perspective

Social media has become a huge part of everyone’s lives. As of 2017, daily social media usage of global internet users amounted to 135 minutes per day. When it comes to extreme averages, teenagers take the prize. Their daily average time spent on social media is nine hours a day. That’s longer than most people spend sleeping or in school.

As we spend increasing amounts of time online, and new technologies allow us to connect further in the virtual world, the further we connect, the further we create online issues. One such major issue is online harassment.

In a survey of over 3,000 Americans, 47% reported experiencing some sort of online harassment or abuse. To curb this issue, one of the steps taken from Google is to come up with a technology which could help improve online conversations. Introducing Google Perspective.

Google Perspective:

Perspective is an API that makes it easier to host better conversations. The API uses machine learning models to score the perceived impact a comment might have on a conversation. Developers and publishers can use this score to give real-time feedback to commenters or help moderators do their job, or allow readers to more easily find relevant information. Perspective identifies whether a comment could be perceived as “toxic” to a discussion.

How to use Google Perspective?

  1. Well, first you need access to Google’s Perspective API. Which can be availed by getting whitelisted by the perspective team. Apply here

  2. Once you get whitelisted, go ahead & create a Google Cloud project.

  3. Search for ‘Perspective API’ from the list of Google API’s, then go to the Perspective API’s overview page and click Enable.

  4. To authenticate your requests, you’ll need to generate credentials for your project. Using an API key is the simplest option. Go to the API credentials page, click Create credentials, and choose “API Key”.

Now you have everything, except a nodejs client to find “Toxicity/Profanity” of a comment using Google Perspective.

Tada…. & here is your open source nodejs client for Google Perspective:
I, open sourced a nodejs client for Google perspective with a clear-cut documentation for a quick start. Click on the below link, use it & feel free to raise an issue if you find any.

GitHub logo sandeshbsuvarna / Comment-Toxicity-Profanity-Analyzer

Comment Toxicity/Profanity Analyzer, will help help increase empathy, participation and quality in online conversation at scale using Google's perspective api

Comment Toxicity/Profanity Analyzer | Nodejs, Google Perspective API

npm version node version

Comment Toxicity/Profanity Analyzer, will help help increase empathy, participation and quality in online conversation at scale. #ConversationAI #GooglePerspectiveAPI

Quick Start

  1. Get whitelisted to use perspective api To use the API, your you need to have your email address whitelisted. Apply here.

  2. Create a Google Cloud project. Go to the Google Cloud console to create a new project You can also use an existing project, if you have one.

  3. Enable the API. Once you've been whitelisted, you'll be able to enable the API in for your project. Go to the Perspective API's overview page and click Enable.

  4. Generate an API key. To authenticate your requests, you'll need to generate credentials for your project. Using an API key is the simplest option. Go to the API credentials page, click Create credentials, and choose "API Key".

  5. Make an AnalyzeComment request

                    The Internet Should Be a Good Place
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
sandeshsuvarna
Sandesh B Suvarna (Iconic.wtf)

Posted on November 16, 2018

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related