Sandesh B Suvarna


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?

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

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

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

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.

The Internet Should Be a Good Place

More by Sandesh B Suvarna

Topics of interest

More Related Stories