xiaobinqt / sensitive-words-filter
sensitive words filter
0.0.1
2019-07-25 14:29 UTC
Requires
- mockery/mockery: ^1.2
- phpunit/phpunit: ^6.5
This package is auto-updated.
Last update: 2024-05-26 01:12:08 UTC
README
sensitive words filter.
Installing
$ composer require xiaobinqt/sensitive-words-filter -vvv
Usage
use Xiaobinqt\SensitiveWordsFilter\SensitiveWordsFilter; $haystack = "淫色 | ? [] sdfs0221。?!,、;:「」『』“”‘’()【】《》〈〉 电影"; $obj = new SensitiveWordsFilter(); try { $ret = $obj->filter($haystack); var_dump($ret); } catch (Exception $exception) { // TODO }
Return Resource
array( 'costTimeMs' => 21571.157217026, 'sensitiveWords' => "淫色电影" );
Advanced usage
- 自定义敏感词文件
$senPath = __DIR__ . DIRECTORY_SEPARATOR . 'mysen.txt'; $obj = new SensitiveWordsFilter($senPath);
- 自定义敏感词数组
$obj = new SensitiveWordsFilter(null, array("台湾独立建国"));
Contributing
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- Contribute new features or update the wiki.
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.
License
MIT