| 227 | |
| 228 | @app.post("/analyze") |
| 229 | def analyze(req: AnalyzeRequest) -> list[dict[str, Any]]: |
| 230 | started = time.perf_counter() |
| 231 | results = analyzer.analyze( |
| 232 | text=req.text, |
| 233 | language=req.language, |
| 234 | entities=req.entities or None, |
| 235 | score_threshold=req.score_threshold, |
| 236 | return_decision_process=req.return_decision_process, |
| 237 | ) |
| 238 | logger.info( |
| 239 | "analyze lang=%s chars=%d entities=%d duration_ms=%.1f", |
| 240 | req.language, |
| 241 | len(req.text), |
| 242 | len(results), |
| 243 | (time.perf_counter() - started) * 1000, |
| 244 | ) |
| 245 | return [r.to_dict() for r in results] |
| 246 | |
| 247 | |
| 248 | @app.post("/analyze_batch") |