该项目主要用作于敏感词检测,并将检测到的敏感词屏蔽为*号.
go get github.com/yuansudong/sensitive
package main
import (
"github.com/yuansudong/sensitive"
)
// _LoadSensitiveWords 加载敏感词
func _LoadSensitiveWords() []string {
return []string{
"haha",
"hello",
"悲",
}
}
func main() {
sensitive.Init(_LoadSensitiveWords)
mInst := sensitive.Get()
log.Println(mInst.Replace("haha,人生若如初见,何事秋风悲画扇"))
mInst.Release()
}