MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / AcSearch

Function AcSearch

service/str.go:81–101  ·  view source on GitHub ↗
(findText string, dict []string, stopImmediately bool)

Source from the content-addressed store, hash-verified

79}
80
81func AcSearch(findText string, dict []string, stopImmediately bool) (bool, []string) {
82 if len(dict) == 0 {
83 return false, nil
84 }
85 if len(findText) == 0 {
86 return false, nil
87 }
88 m := InitAc(dict)
89 if m == nil {
90 return false, nil
91 }
92 hits := m.MultiPatternSearch([]rune(findText), stopImmediately)
93 if len(hits) > 0 {
94 words := make([]string, 0)
95 for _, hit := range hits {
96 words = append(words, string(hit.Word))
97 }
98 return true, words
99 }
100 return false, nil
101}

Callers 2

ShouldDisableChannelFunction · 0.85
SensitiveWordContainsFunction · 0.85

Calls 1

InitAcFunction · 0.85

Tested by

no test coverage detected