How to Perform Profanity and Obscene Language Analysis and Detection on Text with JavaScript

Hey — no cursing on my website!

Are you getting tired of asking people to keep it clean? We hear you. When you include our Profanity and Obscene Language Detection API in your app, you won’t have to. This API analyzes (English) natural language text inputs and provides a score indicating the degree to which the text in question is profane or obscene. That score will range from 0.0 to 1.0, with lower numbers indicating little profanity was detected, and higher numbers indicating a lot of profanity was detected.

To structure your API call in JavaScript, follow instructions to include ready-to-run code snippets below.

Let’s install the jQuery library first:

bower install jquery

Then let’s include the code for our API call:

var settings = {
"url": "https://api.cloudmersive.com/nlp-v2/analytics/profanity",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/x-www-form-urlencoded",
"Apikey": "YOUR-API-KEY-HERE"
},
"data": {
"TextToAnalyze": "<string>"
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});

You’ll need to include your Cloudmersive API key (attainable by creating a free account on our website — Home — Cloudmersive APIs) and configure your text input where indicated in the documentation. Once you do that, you’re all good to go.

--

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

3 Techniques for Fast Debugging of a React Component

Currency API: How to Convert Prices (with up-to-date exchange rates) with JavaScript

JavaScript’s infamous Babylon.js #1

Animated Scaling Button in React Native

test this medium post

Virtual DOM

RxSwift: Various Operators 2

Securing Angular + Spring Boot Application with Okta Authorization Server

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
Cloudmersive

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

More from Medium

OCR Preprocessing API — Convert an Image of Text into Binarized (Light & Dark View)

OJET — Proxy to Backend REST API Server

Authentication with Dj-rest-auth

ODOO Remote Procedure Calling