Comment Toxicity/Profanity Analyzer, will help help increase empathy, participation and quality in online conversation at scale. #ConversationAI #GooglePerspectiveAPI
-
Get whitelisted to use perspective api To use the API, your you need to have your email address whitelisted. Apply here.
-
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.
-
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.
-
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".
-
Make an AnalyzeComment request using above node.js codebase
5a. update your
.env
with API Key5b. run
npm install
5c. run
node perspective.js
Note: 0.1 is a lower score, where as 1.0 higher score.
There are quite a few experimental models, such as "obscene", "attack on a commenter", "spam", etc, that you may find interesting.
The source code is licensed under MIT.