File size: 926 Bytes
f1f0b30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""Compute wow_filter hit-rate from a seeds JSON and write a markdown report."""

from __future__ import annotations

import argparse
import json
import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parent.parent))

from aether_ad.cli.commands import hit_rate_report  # noqa: E402


def main() -> int:
    p = argparse.ArgumentParser()
    p.add_argument("--input", type=Path, required=True)
    p.add_argument("--report", type=Path, default=Path("outputs/hit_rate_report.md"))
    p.add_argument("--threshold", type=float, default=0.5)
    args = p.parse_args()
    data = json.loads(args.input.read_text(encoding="utf-8"))
    md = hit_rate_report(data, threshold=args.threshold)
    args.report.parent.mkdir(parents=True, exist_ok=True)
    args.report.write_text(md, encoding="utf-8")
    print(f"Wrote {args.report}")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())