contentflag

package
v1.9.16 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLanguages = []string{"en"}

DefaultLanguages is what projects get when they have not chosen packs (and what the ingest falls back to when no project is resolvable).

Functions

func AvailableLanguages

func AvailableLanguages() []string

AvailableLanguages returns the built-in pack codes, sorted.

func IsValidLanguage

func IsValidLanguage(code string) bool

IsValidLanguage reports whether a built-in pack exists for the code.

Types

type Matcher

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

Matcher scans text for flagged terms using whole-token matching, so a term never matches inside a larger word (no Scunthorpe-style false positives).

func NewMatcher

func NewMatcher(languages []string, customTerms []string) *Matcher

NewMatcher returns a matcher over the selected language packs merged with the given per-project custom terms. nil languages means DefaultLanguages; an explicitly empty (non-nil) slice means no built-in packs, custom terms only. Unknown language codes are ignored.

func (*Matcher) Scan

func (m *Matcher) Scan(texts ...string) []string

Scan returns the sorted, deduplicated flagged terms found in the given texts, capped at maxMatches. Phrase terms are reported space-joined.

Jump to

Keyboard shortcuts

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