Mask many texts in one pass, returning masked text per item in request order — the batched counterpart to /anonymize. Anonymization is pure string work (no NLP), so callers should send only items with detected spans.
(req: AnonymizeBatchRequest)
| 286 | |
| 287 | @app.post("/anonymize_batch") |
| 288 | def anonymize_batch(req: AnonymizeBatchRequest) -> dict[str, list[str]]: |
| 289 | """Mask many texts in one pass, returning masked text per item in request |
| 290 | order — the batched counterpart to /anonymize. Anonymization is pure string |
| 291 | work (no NLP), so callers should send only items with detected spans.""" |
| 292 | operators = build_operators(req.anonymizers or req.operators) |
| 293 | return { |
| 294 | "texts": [ |
| 295 | run_anonymize(item.text, item.analyzer_results, operators).text |
| 296 | for item in req.items |
| 297 | ] |
| 298 | } |
nothing calls this directly
no test coverage detected