(input_dir: Path, output_dir: Path, roles_file: Path, top_k: int = DEFAULT_TOP_K)
| 463 | |
| 464 | |
| 465 | def run_baseline(input_dir: Path, output_dir: Path, roles_file: Path, top_k: int = DEFAULT_TOP_K) -> Dict[str, Any]: |
| 466 | rows, label_rows = load_clean_benchmark_inputs(input_dir) |
| 467 | episode_rows = load_jsonl(input_dir / "episodes.jsonl") |
| 468 | output_dir.mkdir(parents=True, exist_ok=True) |
| 469 | reranked_rows, method_stats = rerank_episodes( |
| 470 | rows, |
| 471 | label_rows, |
| 472 | input_dir=input_dir, |
| 473 | roles_file=roles_file, |
| 474 | top_k=top_k, |
| 475 | ) |
| 476 | write_jsonl(output_dir / "episode_papers.jsonl", reranked_rows) |
| 477 | write_jsonl(output_dir / "episodes.jsonl", episode_rows) |
| 478 | for file_name in ("users.json", "manifest.json"): |
| 479 | source = input_dir / file_name |
| 480 | if source.exists(): |
| 481 | shutil.copyfile(source, output_dir / file_name) |
| 482 | evaluation = write_evaluation(output_dir, reranked_rows, episode_rows) |
| 483 | method_stats["input_rows"] = len(rows) |
| 484 | method_stats["output_rows"] = len(reranked_rows) |
| 485 | method_stats["using_clean_input"] = True |
| 486 | (output_dir / "nl_profile_summary.json").write_text( |
| 487 | json.dumps(method_stats, ensure_ascii=False, indent=2), |
| 488 | encoding="utf-8", |
| 489 | ) |
| 490 | return {"method_stats": method_stats, "evaluation": evaluation} |
| 491 | |
| 492 | |
| 493 | def parse_args() -> argparse.Namespace: |
no test coverage detected