(
input_dir: Path,
output_dir: Path,
*,
roles_file: Path,
top_k: int = DEFAULT_TOP_K,
)
| 751 | |
| 752 | |
| 753 | def run_baseline( |
| 754 | input_dir: Path, |
| 755 | output_dir: Path, |
| 756 | *, |
| 757 | roles_file: Path, |
| 758 | top_k: int = DEFAULT_TOP_K, |
| 759 | ) -> Dict[str, Any]: |
| 760 | input_dir = input_dir.resolve() |
| 761 | output_dir = output_dir.resolve() |
| 762 | episodes_path = input_dir / "episodes.jsonl" |
| 763 | if not episodes_path.exists(): |
| 764 | raise FileNotFoundError(f"Missing benchmark episodes: {episodes_path}") |
| 765 | |
| 766 | output_dir.mkdir(parents=True, exist_ok=True) |
| 767 | rows, label_rows = load_clean_benchmark_inputs(input_dir) |
| 768 | episode_rows = load_jsonl(episodes_path) |
| 769 | reranked_rows, method_stats = rerank_episodes( |
| 770 | rows, |
| 771 | label_rows, |
| 772 | top_k=top_k, |
| 773 | roles_file=roles_file, |
| 774 | input_dir=input_dir, |
| 775 | ) |
| 776 | |
| 777 | write_jsonl(output_dir / "episode_papers.jsonl", reranked_rows) |
| 778 | shutil.copy2(episodes_path, output_dir / "episodes.jsonl") |
| 779 | if (input_dir / "users.json").exists(): |
| 780 | shutil.copy2(input_dir / "users.json", output_dir / "users.json") |
| 781 | |
| 782 | evaluation = write_evaluation(output_dir, reranked_rows, episode_rows) |
| 783 | method_stats["input_dir"] = str(input_dir) |
| 784 | method_stats["output_dir"] = str(output_dir) |
| 785 | method_stats["roles_file"] = str(roles_file) |
| 786 | method_stats["using_clean_input"] = True |
| 787 | (output_dir / "discourse_aware_summary.json").write_text( |
| 788 | json.dumps(method_stats, ensure_ascii=False, indent=2), |
| 789 | encoding="utf-8", |
| 790 | ) |
| 791 | return {"method_stats": method_stats, "evaluation": evaluation} |
| 792 | |
| 793 | |
| 794 | def parse_args() -> argparse.Namespace: |
no test coverage detected