MCPcopy
hub / github.com/mudler/LocalAI / spanCoversSubstring

Function spanCoversSubstring

tests/e2e/e2e_pii_ner_test.go:146–159  ·  view source on GitHub ↗
(text string, ents []backend.TokenEntity, sub string)

Source from the content-addressed store, hash-verified

144}
145
146func spanCoversSubstring(text string, ents []backend.TokenEntity, sub string) bool {
147 lo := bytes.Index([]byte(text), []byte(sub))
148 if lo < 0 {
149 return false
150 }
151 hi := lo + len(sub)
152 for _, e := range ents {
153 // any overlap with [lo,hi)
154 if e.Start < hi && e.End > lo {
155 return true
156 }
157 }
158 return false
159}
160
161func analyze(req schema.PIIAnalyzeRequest) (int, schema.PIIAnalyzeResponse) {
162 GinkgoHelper()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected