nexuslinkservices/abuse-keyword-purifier
v1.2.2
2016-09-17 06:11 UTC
Requires
- php: >=5.6.2
Requires (Dev)
- phpunit/phpunit: 5.5.*
- symfony/yaml: ~2.3|~3.0
This package is not auto-updated.
Last update: 2024-09-14 19:53:04 UTC
README
从内容中替换或删除滥用关键词。
安装
如果您使用composer,可以通过运行以下命令添加此包:
composer require galiteintechnologies/abuse-keyword-purifier
用法
创建包含不良词列表和替换不良词的字符的配置文件。例如。
profanities:
replace_with: '*'
bad_words: ['abuser', 'bitch', 'bitcher']
如果您想从内容中删除不良词,只需为replace_with字段留空值即可,例如:replace_with: ''
如果您不创建配置文件,则它将使用由包提供的配置文件,其中包括所有不良词列表。
示例用法
<?php
use AbuseKeywordPurifier\ProfanityFilter;
$profanityFilter = new ProfanityFilter();
$content = "I do not want to use such bad word like bastard. Another bad word I want to remove is bitch.";
$result = $profanityFilter->filterProfanities($content);
输出
I do not want to use such bad word like *******. Another bad word I want to remove is *****.
贡献
欢迎提出拉取请求。