How to Perform Obscenity Analysis on Text in Node.JS

In allowing comments from users to be placed on your site, you allow your potential audience to see and relate with the past experiences and successes of your products. Furthermore, it provides you with an easy-to-use channel for interacting with your consumer base. However, in opening your page for public comment, you may run the danger of receiving inappropriate or profane responses that should have no place on the user-facing side of your site. In order to prevent these kinds of comments from being accidentally overlooked, the following API will allow you to instantly perform a profanity and obscene language analysis to determine if any input contains profane language.

Image for post
Image for post

To run this function, we first need to install the SDK with this command:

npm install cloudmersive-nlp-api-client --save

Or, you can add this snippet to your package.json:

"dependencies": {
"cloudmersive-nlp-api-client": "^2.0.9"

Then, we can call the function:

var CloudmersiveNlpApiClient = require('cloudmersive-nlp-api-client');
var defaultClient = CloudmersiveNlpApiClient.ApiClient.instance;

Now you can ensure your platform remains an inviting and appropriate space for your business. You can retrieve the API Key from Cloudmersive at no cost and with no commitment. It will provide access to 800 monthly calls across our entire library of APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store