Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileStock ¶
type FileStock struct {
// contains filtered or unexported fields
}
func NewFileStock ¶
type Filter ¶
type Filter interface { // Excludes 用于设置需要排除的内容,主要用于忽略敏感词中间的特殊字符 // 比如: // 将中线(-)设置为排除内容,同时将 "今天" 设置为敏感词 // 匹配的时候, "今天" 和 "今-天" 都将被判定为敏感词 Excludes(runes ...rune) // Contains 用于检测是否有敏感词:如果有敏感词,返回 true;如果没有敏感词,返回 false; Contains(text string) bool // FindFirst 用于查找出第一个敏感词 FindFirst(text string) string // FindAll 用于查找出所有敏感词 FindAll(text string) []string // Replace 用于替换敏感词 Replace(text string, replace rune) string }
type MemoryStock ¶
type MemoryStock struct {
// contains filtered or unexported fields
}
func NewMemoryStock ¶
func NewMemoryStock(words ...string) (*MemoryStock, error)
func (*MemoryStock) ReadAll ¶
func (m *MemoryStock) ReadAll() []string
type TrieFilter ¶
type TrieFilter struct {
// contains filtered or unexported fields
}
func NewTrieFilter ¶
func NewTrieFilter(stock WordStock) *TrieFilter
func (*TrieFilter) Contains ¶
func (filter *TrieFilter) Contains(text string) bool
func (*TrieFilter) Excludes ¶
func (filter *TrieFilter) Excludes(runes ...rune)
func (*TrieFilter) FindAll ¶
func (filter *TrieFilter) FindAll(text string) []string
func (*TrieFilter) FindFirst ¶
func (filter *TrieFilter) FindFirst(text string) string
Click to show internal directories.
Click to hide internal directories.