Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Lustre authored Jul 24, 2017
1 parent 8aa8e06 commit daf4cd2
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,25 @@ php实现基于确定有穷自动机算法的铭感词过滤
......
);

> 实例化敏感词过滤助手
$sensitiveWordHelper = Lib\SensitiveWordFilterHelper::init();

> 构建敏感词hashMap
//构建敏感词hashMap
$sensitiveWordMap = LSensitiveWordFilter::init()->setHashMap($wordData);
$sensitiveWordMap = $sensitiveWordHelper->setHashMap($wordData);

> 敏感词过滤
//敏感词替换为***为例
LSensitiveWordFilter::init()->replaceSensitiveWord($sensitiveWordMap, $content, '***');
$filterContent = $sensitiveWordHelper->replaceSensitiveWord($sensitiveWordMap, $content, '***');

> 你也可以获取文字中的敏感词
//获取内容中所有的敏感词
$sensitiveWordGroup = LSensitiveWordFilter::init()->getSensitiveWord($sensitiveWordMap, $content);
$sensitiveWordGroup = $sensitiveWordHelper->getSensitiveWord($sensitiveWordMap, $content);
//仅且获取一个敏感词
$sensitiveWordGroup = LSensitiveWordFilter::init()->getSensitiveWord($sensitiveWordMap, $content, 1);
$sensitiveWordGroup = $sensitiveWordHelper->getSensitiveWord($sensitiveWordMap, $content, 1);

*如果大家有更好的建议,请大家多多指正,O(∩_∩)O谢谢*
*如果大家有更好的建议,请大家多多指正,O(∩_∩)O谢谢*

0 comments on commit daf4cd2

Please sign in to comment.