(label: str, results: list[tuple[str, float]])
| 59 | |
| 60 | |
| 61 | def show(label: str, results: list[tuple[str, float]]) -> None: |
| 62 | print(f"\n{label}") |
| 63 | for i, (doc_id, score) in enumerate(results[:5], 1): |
| 64 | text = corpus.loc[corpus["_id"] == doc_id, "text"].iloc[0] |
| 65 | print(f" {i}. [{score:.4f}] {doc_id} {text[:70]}") |
| 66 | |
| 67 | |
| 68 | if __name__ == "__main__": |