setTreeByFile() setTreeByFile(string $filepath = '') : $this 构建铭感词树【文件模式】 Parameters string $filepath Throws \Exception Returns $this —
setTree() setTree(null $sensitiveWords = null) : $this 构建铭感词树【数组模式】 Parameters null $sensitiveWords Throws \Exception Returns $this —
getBadWord() getBadWord(string $content, int $matchType = 1, int $wordNum) : array 检测文字中的敏感词 Parameters string $content 待检测内容 int $matchType 匹配类型 [默认为最小匹配规则] int $wordNum 需要获取的敏感词数量 [默认获取全部] Returns array —
replace() replace( $content, string $replaceChar = '', bool $repeat = false, int $matchType = 1) : mixed 替换敏感字字符 Parameters $content 文本内容 string $replaceChar 替换字符 bool $repeat true=>重复替换为敏感词相同长度的字符 int $matchType Returns mixed —
mark() mark( $content, string $sTag, string $eTag, int $matchType = 1) : mixed 标记敏感词 Parameters $content 文本内容 string $sTag 标签开头,如 string $eTag 标签结束,如 int $matchType Returns mixed —
yieldToReadFile() yieldToReadFile(mixed $filepath) : mixed Parameters mixed $filepath Returns mixed —
dfaBadWordConversChars() dfaBadWordConversChars( $word, $char) : string 敏感词替换为对应长度的字符 Parameters $word $char Returns string —