Skip to content

6xiaowu9/snstvwd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

敏感词过滤器

PHP基于确定有穷自动机(DFA)敏感词过滤器,支持 Laravel 框架。

安装

1. 利用composer安装包

$ composer require snstvwd/filter

2. 在config/app.php 里面添加:


    'providers' => [
        .
        .
        .
        Snstvwd\Filter\Providers\FilterSerivceProvider::class
    ],
    
    'aliases' => [
        .
        .
        .
        'Filter' => Snstvwd\Filter\Facades\Filter::class
    ]

3. 创建配置文件

php artisan vendor:publish --provider="Snstvwd\Filter\Providers\FilterSerivceProvider"

4. 基本使用


use Filter;

public function test () {
    $text = '他是傻逼吗?';
    $filter = Filter::filter($text)->getText();
    dump($filter);
}

返回实例

他是???吗?

文档

THANK YOU

About

基于PHP的DFA算法敏感词过滤器

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages