Documentation ¶
Index ¶
- type Filter
- func (filter *Filter) AddWord(words ...string)
- func (filter *Filter) Filter(text string) string
- func (filter *Filter) FindAll(text string) []string
- func (filter *Filter) FindIn(text string) (bool, string)
- func (filter *Filter) Load(rd io.Reader) error
- func (filter *Filter) LoadNetWordDict(url string) error
- func (filter *Filter) LoadWordDict(path string) error
- func (filter *Filter) RemoveNoise(text string) string
- func (filter *Filter) Replace(text string, repl rune) string
- func (filter *Filter) UpdateNoisePattern(pattern string)
- func (filter *Filter) Validate(text string) (bool, string)
- type LinkList
- type Node
- type Trie
- func (tree *Trie) Add(words ...string)
- func (tree *Trie) BuildFailureLinks()
- func (tree *Trie) Filter(text string) string
- func (tree *Trie) FindAll(text string) []string
- func (tree *Trie) FindIn(text string) (bool, string)
- func (tree *Trie) Replace(text string, character rune) string
- func (tree *Trie) Validate(text string) (bool, string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶ added in v1.6.6
type Filter struct {
// contains filtered or unexported fields
}
Filter 敏感词过滤器
func (*Filter) LoadNetWordDict ¶ added in v1.6.6
LoadNetWordDict 加载网络敏感词字典
func (*Filter) LoadWordDict ¶ added in v1.6.6
LoadWordDict 加载敏感词字典
func (*Filter) RemoveNoise ¶ added in v1.6.6
RemoveNoise 去除空格等噪音
func (*Filter) UpdateNoisePattern ¶ added in v1.6.6
UpdateNoisePattern 更新去噪模式
type LinkList ¶ added in v1.6.6
type LinkList struct {
// contains filtered or unexported fields
}
LinkList ...
type Node ¶
type Node struct { Character rune Children map[rune]*Node Failure *Node Parent *Node // contains filtered or unexported fields }
Node Trie树上的一个节点.
type Trie ¶
type Trie struct {
Root *Node
}
Trie 短语组成的Trie树.
func (*Trie) BuildFailureLinks ¶ added in v1.6.6
func (tree *Trie) BuildFailureLinks()
BuildFailureLinks 更新Aho-Corasick的失败表
Click to show internal directories.
Click to hide internal directories.