()
| 539 | |
| 540 | |
| 541 | def main() -> None: |
| 542 | parser = argparse.ArgumentParser(description="Build a PaperFlow drift-adaptation specialty table.") |
| 543 | parser.add_argument("--benchmark-dir", type=Path, default=DEFAULT_BENCHMARK_DIR) |
| 544 | parser.add_argument("--method", action="append", default=[], help="Extra method as Name=output_dir.") |
| 545 | parser.add_argument("--pre-days", type=int, default=3) |
| 546 | parser.add_argument("--post-days", type=int, default=7) |
| 547 | parser.add_argument("--k", type=int, default=20) |
| 548 | parser.add_argument("--min-new-topic-hits", type=int, default=3) |
| 549 | parser.add_argument("--output-prefix", type=Path, default=None) |
| 550 | args = parser.parse_args() |
| 551 | |
| 552 | benchmark_dir = args.benchmark_dir.resolve() |
| 553 | method_specs = default_methods(benchmark_dir) |
| 554 | method_specs.extend(parse_method_arg(raw) for raw in args.method) |
| 555 | if not method_specs: |
| 556 | raise SystemExit("No method episode_papers.jsonl files found.") |
| 557 | |
| 558 | rows, context = build_rows( |
| 559 | benchmark_dir, |
| 560 | method_specs, |
| 561 | pre_days=max(0, args.pre_days), |
| 562 | post_days=max(0, args.post_days), |
| 563 | k=max(1, args.k), |
| 564 | min_new_topic_hits=max(1, args.min_new_topic_hits), |
| 565 | ) |
| 566 | |
| 567 | output_prefix = args.output_prefix |
| 568 | if output_prefix is None: |
| 569 | output_prefix = benchmark_dir / "main_experiment" / "drift_adaptation_experiment" |
| 570 | output_prefix = output_prefix.resolve() |
| 571 | |
| 572 | write_csv(output_prefix.with_suffix(".csv"), rows) |
| 573 | write_markdown(output_prefix.with_suffix(".md"), rows, context) |
| 574 | output_prefix.with_suffix(".json").write_text( |
| 575 | json.dumps({"context": context, "rows": rows}, ensure_ascii=False, indent=2), |
| 576 | encoding="utf-8", |
| 577 | ) |
| 578 | |
| 579 | print(f"Wrote {output_prefix.with_suffix('.md')}") |
| 580 | print(f"Wrote {output_prefix.with_suffix('.csv')}") |
| 581 | print(f"Wrote {output_prefix.with_suffix('.json')}") |
| 582 | |
| 583 | |
| 584 | if __name__ == "__main__": |
no test coverage detected