Skip to content

Latest commit

 

History

History
27 lines (22 loc) · 565 Bytes

README.md

File metadata and controls

27 lines (22 loc) · 565 Bytes

sensitive-word-detect

sensitive words detection

Golang version of observerss/textfilter

  • toy work for ByteDance backend trainingcamp

Example

package utils

import (
	"github.com/Karshilov/sensitive-word-detect/automaton"
	"github.com/Karshilov/sensitive-word-detect/utils"
)

var SensitiveWordsFilter = func() automaton.ACAutomaton {
	keywords, _ := utils.GetKeywords()
	ac := automaton.ACAutomaton{}
	ac.Reserve(1000000)
	for _, v := range keywords {
		ac.Insert(v)
	}
	ac.Build()
	return ac
}()