dfa

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 DFAMatcher

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

DFAMatcher implements a Deterministic Finite Automaton for pattern matching

func NewDFAMatcher

func NewDFAMatcher(caseSensitive bool) *DFAMatcher

NewDFAMatcher creates a new DFA matcher instance

func (*DFAMatcher) Build

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

Build constructs the DFA from the given words

func (*DFAMatcher) Match

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

Match finds all sensitive words in the text

func (*DFAMatcher) Replace

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

Replace replaces all sensitive words with the given replacement rune

func (*DFAMatcher) Validate

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

Validate checks if the text contains any sensitive words

type State

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

State represents a state in the DFA with type-safe transitions

Jump to

Keyboard shortcuts

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