tokenClassify drives core/backend.ModelTokenClassify against the live model with the loader/config the running server uses — the same path the NER detector takes, but at Threshold 0 so we see the raw, unmerged spans.
(text string)
| 115 | // with the loader/config the running server uses — the same path the NER |
| 116 | // detector takes, but at Threshold 0 so we see the raw, unmerged spans. |
| 117 | func tokenClassify(text string) []backend.TokenEntity { |
| 118 | GinkgoHelper() |
| 119 | cfg, ok := localAIApp.ModelConfigLoader().GetModelConfig(piiNERModel) |
| 120 | Expect(ok).To(BeTrue(), "model config %q must be loaded", piiNERModel) |
| 121 | fn, err := backend.ModelTokenClassify(text, backend.TokenClassifyOptions{}, |
| 122 | localAIApp.ModelLoader(), cfg, localAIApp.ApplicationConfig()) |
| 123 | Expect(err).NotTo(HaveOccurred()) |
| 124 | ents, err := fn(context.TODO()) |
| 125 | Expect(err).NotTo(HaveOccurred()) |
| 126 | return ents |
| 127 | } |
| 128 | |
| 129 | // assertByteCorrectSpan is the shared byte-offset invariant: a half-open byte |
| 130 | // range within text, aligned to UTF-8 rune boundaries, whose slice equals the |
no test coverage detected