Function
spanCoversSubstring
(text string, ents []backend.TokenEntity, sub string)
Source from the content-addressed store, hash-verified
| 144 | } |
| 145 | |
| 146 | func 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 | |
| 161 | func analyze(req schema.PIIAnalyzeRequest) (int, schema.PIIAnalyzeResponse) { |
| 162 | GinkgoHelper() |
Tested by
no test coverage detected