MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / AddKeyword

Method AddKeyword

utils/contentfilter/contentfilter.go:49–60  ·  view source on GitHub ↗
(keyword string)

Source from the content-addressed store, hash-verified

47}
48
49func (sf *SensitiveFilter) AddKeyword(keyword string) {
50 node := sf.root
51 for _, char := range keyword {
52 subNode := node.getSubNode(char)
53 if subNode == nil {
54 subNode = newTrieNode()
55 node.addSubNode(char, subNode)
56 }
57 node = subNode
58 }
59 node.isKeywordEnd = true
60}
61func (sf *SensitiveFilter) Filter(text string) string {
62 if text == "" {
63 return text

Callers 1

LoadFromFileMethod · 0.95

Calls 3

newTrieNodeFunction · 0.85
getSubNodeMethod · 0.80
addSubNodeMethod · 0.80

Tested by

no test coverage detected