Documentation
¶
Overview ¶
Package sensitivewords 敏感词过滤
example: words := sensitivewords.NewSensitiveWords().LoadKeywords(app.Root() + "/configs/debug/keywords.csv") fmt.Println(words.HasKeywords("鸡巴"))
Index ¶
- type Store
- func (store Store) Add(keywords string)
- func (store Store) AppendToFile(keywords string) (n int, err error)
- func (store Store) Filter(input string, replace rune) string
- func (store Store) HasKeywords(input string) bool
- func (store Store) KeywordsList(input string) []string
- func (store Store) LoadKeywords(filename string) Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store map[rune]*node
Store 关键字节点
func (Store) AppendToFile ¶
AppendToFile 增加新的关键字时, 将同时写入到文件
func (Store) KeywordsList ¶
KeywordsList 获取触发的敏感词列表
func (Store) LoadKeywords ¶
LoadKeywords 加载文件中的关键字, 按行分割
Click to show internal directories.
Click to hide internal directories.