package filter import ( "github.com/importcjj/sensitive" "os" "path/filepath" ) var filter *sensitive.Filter func init() { initFilter() } func initFilter() { wd, _ := os.Getwd() filter = sensitive.New() filter.LoadWordDict(filepath.Join(wd, "keywords")) } func Replace(content string) string { if filter == nil { initFilter() } return filter.Replace(content, '*') }