ac

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACMatcher

type ACMatcher struct {
	// contains filtered or unexported fields
}

ACMatcher implements the Aho-Corasick algorithm for multi-pattern matching

func NewACMatcher

func NewACMatcher(caseSensitive bool) *ACMatcher

NewACMatcher creates a new AC matcher instance

func (*ACMatcher) Build

func (m *ACMatcher) Build(words []dict.Word) error

Build constructs the AC automaton from the given words

func (*ACMatcher) Match

func (m *ACMatcher) Match(text string) []algorithm.MatchResult

Match finds all sensitive words in the text

func (*ACMatcher) Replace

func (m *ACMatcher) Replace(text string, repl rune) string

Replace replaces all sensitive words with the given replacement rune

func (*ACMatcher) Validate

func (m *ACMatcher) Validate(text string) bool

Validate checks if the text contains any sensitive words

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node represents a node in the Aho-Corasick trie

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL