PHP code example of iserter / php-ai-text-sanitizer

1. Go to this page and download the library: Download iserter/php-ai-text-sanitizer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

iserter / php-ai-text-sanitizer example snippets


use iSerter\AiTextSanitizer\AITextSanitizer;

$clean = AITextSanitizer::clean_text($aiOutput);

$sanitizer = new AITextSanitizer([
    'normalize_smart_quotes' => true,
    'normalize_dashes'       => true,
]);

$clean = $sanitizer->sanitize($aiOutput);

$result = $sanitizer->clean($aiOutput);

if ($result->wasModified()) {
    error_log($result->getReport()->summary());
}

echo $result->getText();

$report = $sanitizer->detect($aiOutput);

if ($report->hasWatermarks()) {
    foreach ($report->getFindings() as $f) {
        printf("%s %s [%s] x%d\n", $f->notation(), $f->name, $f->category, $f->count);
    }
}
bash
composer 
bash
docker build -t php-ai-text-sanitizer .
docker run --rm php-ai-text-sanitizer
bash
php src/examples/demo.php