Links

Profanity Detection

Overview

This method is used to detect profanity (bad words) in a specific text.

Options

Option
Type
Description
text *
String
The text you want to lookup.
format
String
You can use this option to specify the API output format. Accepts: JSON, XML or CSV. Default: JSON
lang
String
Specifies the API output language. Accepts: EN, AR, DE, FR, ES, JA, JA, ZH or RU. Default: EN
mode
String
You can use this option for using the Development Environment of the API, read more. Accepts: live or test. Default: live

Usage:

Basic example of using this method:
await BadWord({
key: 'your-api-key',
text: 'This is just a sample text (it should be safe).'
})
.then(res => {
console.log(res);
})
.catch(error => {
console.log(error);
});
We can inform the module to return the response as XML:
await BadWord({
key: 'your-api-key',
text: 'This is just a sample text (it should be safe).',
format: 'XML'
})
.then(res => {
console.log(res);
})
.catch(error => {
console.log(error);
});
And so on...
The .then() will return the response if it's successfully fetched and the .catch() will return the error if something goes wrong.
If the request completed successfully, so the res variable of .then() returns the data in the format you specified. And we can read the data like this:
await BadWord({
key: 'your-api-key',
text: 'This is just a sample text (it should be safe).',
})
.then(res => {
console.log(res?.data);
})
.catch(error => {
console.log(error);
});