Documentation
¶
Overview ¶
Package sensitive provides high-performance sensitive word detection using AC automaton Creator: Done-0 Created: 2025-01-15
Package sensitive provides high-performance sensitive word detection using AC automaton Creator: Done-0 Created: 2025-01-15
Package sensitive provides high-performance sensitive word detection using AC automaton Creator: Done-0 Created: 2025-01-15
Package sensitive provides high-performance sensitive word detection using AC automaton Creator: Done-0 Created: 2025-01-15
Index ¶
- Constants
- func LoadAllEmbedded(detector *Detector) error
- func LoadDictDir(dir string) (map[string]Level, error)
- func LoadEmbeddedDict(detector *Detector, name string, level Level) error
- type Builder
- func (b *Builder) AddWord(word string, level Level) *Builder
- func (b *Builder) AddWords(words map[string]Level) *Builder
- func (b *Builder) Build() (*Detector, error)
- func (b *Builder) LoadAllEmbedded() *Builder
- func (b *Builder) LoadDict(path string) *Builder
- func (b *Builder) LoadDictFromURL(url string) *Builder
- func (b *Builder) LoadDictFromURLWithLevel(url string, level Level) *Builder
- func (b *Builder) LoadDictFromURLs(urls []string) *Builder
- func (b *Builder) LoadDictWithLevel(path string, level Level) *Builder
- func (b *Builder) LoadEmbeddedDict(name string, level Level) *Builder
- func (b *Builder) LoadVariantMap(path string) *Builder
- func (b *Builder) MustBuild() *Detector
- func (b *Builder) WithCaseSensitive(sensitive bool) *Builder
- func (b *Builder) WithFilterStrategy(strategy FilterStrategy) *Builder
- func (b *Builder) WithReplaceChar(char rune) *Builder
- func (b *Builder) WithSkipWhitespace(skip bool) *Builder
- func (b *Builder) WithVariant(enable bool) *Builder
- type Detector
- func (d *Detector) AddWord(word string, level Level) error
- func (d *Detector) AddWords(words map[string]Level) error
- func (d *Detector) Build() error
- func (d *Detector) Contains(text string) bool
- func (d *Detector) Detect(text string) *Result
- func (d *Detector) Filter(text string) string
- func (d *Detector) FindAll(text string) []string
- func (d *Detector) FindFirst(text string) *Match
- func (d *Detector) IsVariantEnabled() bool
- func (d *Detector) LoadDict(path string) error
- func (d *Detector) LoadDictFromURL(url string) error
- func (d *Detector) LoadDictFromURLWithLevel(url string, level Level) error
- func (d *Detector) LoadDictFromURLs(urls []string) error
- func (d *Detector) LoadDictWithLevel(path string, level Level) error
- func (d *Detector) LoadVariantMap(path string) error
- func (d *Detector) Stats() *Stats
- func (d *Detector) Validate(text string) bool
- type FilterStrategy
- type Level
- type Match
- type Option
- type Options
- type Result
- type Stats
Constants ¶
View Source
const ( DictHighPolitics = "high_politics.txt" DictHighPornography = "high_pornography.txt" DictHighViolence = "high_violence.txt" DictMediumGeneral = "medium_general.txt" DictLowAd = "low_ad.txt" DictLowURL = "low_url.txt" )
Variables ¶
This section is empty.
Functions ¶
func LoadAllEmbedded ¶
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func (*Builder) LoadAllEmbedded ¶
func (*Builder) LoadDictFromURL ¶
func (*Builder) LoadDictFromURLWithLevel ¶
func (*Builder) LoadDictFromURLs ¶
func (*Builder) LoadDictWithLevel ¶
func (*Builder) LoadEmbeddedDict ¶
func (*Builder) LoadVariantMap ¶
func (*Builder) WithCaseSensitive ¶
func (*Builder) WithFilterStrategy ¶
func (b *Builder) WithFilterStrategy(strategy FilterStrategy) *Builder
func (*Builder) WithReplaceChar ¶
func (*Builder) WithSkipWhitespace ¶
func (*Builder) WithVariant ¶
type Detector ¶
type Detector struct {
// contains filtered or unexported fields
}
func (*Detector) IsVariantEnabled ¶
func (*Detector) LoadDictFromURL ¶
func (*Detector) LoadDictFromURLWithLevel ¶
func (*Detector) LoadDictFromURLs ¶
func (*Detector) LoadDictWithLevel ¶
func (*Detector) LoadVariantMap ¶
type FilterStrategy ¶
type FilterStrategy int
const ( StrategyMask FilterStrategy = iota StrategyRemove StrategyReplace )
type Option ¶
type Option func(*Options)
func WithCaseSensitive ¶
func WithFilterStrategy ¶
func WithFilterStrategy(s FilterStrategy) Option
func WithReplaceChar ¶
func WithSkipWhitespace ¶
func WithVariant ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
comment_filter
command
Package main demonstrates user-generated content filtering system Creator: Done-0 Created: 2025-01-15
|
Package main demonstrates user-generated content filtering system Creator: Done-0 Created: 2025-01-15 |
|
dependency_injection
command
Package main demonstrates dependency injection pattern for production applications Creator: Done-0 Created: 2025-01-15
|
Package main demonstrates dependency injection pattern for production applications Creator: Done-0 Created: 2025-01-15 |
|
fluent_api
command
Package main demonstrates Fluent API pattern for elegant chain calls Creator: Done-0 Created: 2025-01-15
|
Package main demonstrates Fluent API pattern for elegant chain calls Creator: Done-0 Created: 2025-01-15 |
|
high_concurrency
command
Package main demonstrates high concurrency usage for production environments Creator: Done-0 Created: 2025-01-15
|
Package main demonstrates high concurrency usage for production environments Creator: Done-0 Created: 2025-01-15 |
|
quickstart
command
Package main demonstrates the simplest production usage Creator: Done-0 Created: 2025-01-15
|
Package main demonstrates the simplest production usage Creator: Done-0 Created: 2025-01-15 |
|
web_api
command
Package main demonstrates content moderation API for production web services Creator: Done-0 Created: 2025-01-15
|
Package main demonstrates content moderation API for production web services Creator: Done-0 Created: 2025-01-15 |
|
internal
|
|
|
normalizer
Package normalizer provides text normalization for sensitive word detection Creator: Done-0 Created: 2025-01-15
|
Package normalizer provides text normalization for sensitive word detection Creator: Done-0 Created: 2025-01-15 |
|
pool
Package pool provides memory pool optimization Creator: Done-0 Created: 2025-01-15
|
Package pool provides memory pool optimization Creator: Done-0 Created: 2025-01-15 |
|
trie
Package trie implements Double Array Trie and AC automaton for high-performance sensitive word detection Creator: Done-0 Created: 2025-01-15
|
Package trie implements Double Array Trie and AC automaton for high-performance sensitive word detection Creator: Done-0 Created: 2025-01-15 |
Click to show internal directories.
Click to hide internal directories.