Determine whether text contains bad words.
The source code for this repository contains extremely explicit language.
We have written code to determine whether a string contains bad words.
Unfortunately, in order to ensure that this code is functioning properly, we must use explicit language in our own code.
Sorry.
composer require monthly-basis/content-moderation
<?php
require_once('vendor/autoload.php');
$containsBadWords = MonthlyBasis\ContentModeration\Model\Factory\ContainsBadWords::build();
$string = 'hello world';
if ($containsBadWords->containsBadWords($string)) {
echo 'Your string contains bad words!';
} else {
echo 'Phew, your string does not contain bad words.';
}
https://content-moderation.monthly-basis.com/api/v0/contains-bad-words?string=hello+world
JSON response
{
"contains-bad-words": false,
"success": true
}