Documentation ¶
Index ¶
- Constants
- func WithDefaultGroupOpt() option.Option
- func WithRegexOpt() option.Option
- type Filter
- func (filter *Filter) AddWord(words ...string)
- func (filter *Filter) DelWord(words ...string)
- func (filter *Filter) Filter(text string) string
- func (filter *Filter) FindAll(text string) []*trie.Group
- func (filter *Filter) FindIn(text string) (bool, string)
- func (filter *Filter) Load(rd io.Reader) error
- func (filter *Filter) LoadWordDict(path string) error
- func (filter *Filter) LoadWordDictByNetworkFile(url string) error
- func (filter *Filter) RemoveNoise(text string) string
- func (filter *Filter) Replace(text string, repl rune, replaceF func(repl rune) string) string
- func (filter *Filter) UpdateNoisePattern(pattern string)
- func (filter *Filter) Validate(text string) (bool, string)
- type Regexp
- func (r *Regexp) Add(reg string) (*regexp.Regexp, error)
- func (r *Regexp) Del(reg string)
- func (r *Regexp) Filter(text string) string
- func (r *Regexp) FindAll(text string) []*trie.Group
- func (r *Regexp) FindIn(text string) (bool, string)
- func (r *Regexp) Replace(text string, repl string) string
- func (r *Regexp) Validate(text string) (bool, string)
- type SensMgr
Constants ¶
View Source
const DefaultGroup = "def"
Variables ¶
This section is empty.
Functions ¶
func WithDefaultGroupOpt ¶ added in v1.20.11
func WithRegexOpt ¶ added in v1.20.11
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter 敏感词过滤器
func (*Filter) LoadWordDict ¶
LoadWordDict 加载敏感词字典
func (*Filter) LoadWordDictByNetworkFile ¶ added in v0.5.36
LoadWordDictByNetworkFile 加载网络敏感词字典,文本文件
func (*Filter) RemoveNoise ¶
RemoveNoise 去除空格等噪音
func (*Filter) UpdateNoisePattern ¶
UpdateNoisePattern 更新去噪模式
type Regexp ¶ added in v0.5.36
type Regexp struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.