monthly-basis/content-moderation

v0.17.0 2023-11-21 19:34 UTC

This package is auto-updated.

Last update: 2024-03-21 20:34:11 UTC


README

Determine whether text contains bad words.

WARNING

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.

Installation

composer require monthly-basis/content-moderation

Examples

Standalone PHP

<?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.';
}

GET Request

https://content-moderation.monthly-basis.com/api/v0/contains-bad-words?string=hello+world

JSON response

{
    "contains-bad-words": false,
    "success": true
}