xiaobinqt / sensitive-words-filter
sensitive words filter
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/xiaobinqt/sensitive-words-filter
Requires
- mockery/mockery: ^1.2
- phpunit/phpunit: ^6.5
This package is auto-updated.
Last update: 2025-10-26 04:15:52 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