File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -14,21 +14,25 @@ php实现基于确定有穷自动机算法的铭感词过滤
1414 ......
1515 );
1616
17+ > 实例化敏感词过滤助手
18+
19+ $sensitiveWordHelper = Lib\SensitiveWordFilterHelper::init();
20+
1721> 构建敏感词hashMap
1822
1923 //构建敏感词hashMap
20- $sensitiveWordMap = LSensitiveWordFilter::init() ->setHashMap($wordData);
24+ $sensitiveWordMap = $sensitiveWordHelper ->setHashMap($wordData);
2125
2226> 敏感词过滤
2327
2428 //敏感词替换为***为例
25- LSensitiveWordFilter::init() ->replaceSensitiveWord($sensitiveWordMap, $content, '***');
29+ $filterContent = $sensitiveWordHelper ->replaceSensitiveWord($sensitiveWordMap, $content, '***');
2630
2731> 你也可以获取文字中的敏感词
2832
2933 //获取内容中所有的敏感词
30- $sensitiveWordGroup = LSensitiveWordFilter::init() ->getSensitiveWord($sensitiveWordMap, $content);
34+ $sensitiveWordGroup = $sensitiveWordHelper ->getSensitiveWord($sensitiveWordMap, $content);
3135 //仅且获取一个敏感词
32- $sensitiveWordGroup = LSensitiveWordFilter::init() ->getSensitiveWord($sensitiveWordMap, $content, 1);
36+ $sensitiveWordGroup = $sensitiveWordHelper ->getSensitiveWord($sensitiveWordMap, $content, 1);
3337
34- * 如果大家有更好的建议,请大家多多指正,O(∩_ ∩)O谢谢*
38+ * 如果大家有更好的建议,请大家多多指正,O(∩_ ∩)O谢谢*
You can’t perform that action at this time.
0 commit comments