UnsolvedAstronomy / scripts /extract_candidates.py
przemekch's picture
Release UnsolvedAstronomy v1.0.0 (10,000 open/partially solved problems + 80 archived/audit records)
fb17822 verified
Raw History Blame Contribute Delete
1.11 kB
#!/usr/bin/env python3
"""
Candidate extraction summary & export tool for UnsolvedAstronomy v1.0.0.
Summarizes harvested candidates in raw/harvested_astronomy_candidates.jsonl and data/candidates/extracted_candidates.jsonl.
"""
import json
from collections import Counter
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
HARVEST_FILE = ROOT / "raw" / "harvested_astronomy_candidates.jsonl"
CANDIDATES_FILE = ROOT / "data" / "candidates" / "extracted_candidates.jsonl"
def main():
if not HARVEST_FILE.exists():
print(f"No harvested file at {HARVEST_FILE}; run scripts/harvest_astronomy_candidates.py first.")
return
rows = [json.loads(line) for line in HARVEST_FILE.open("r", encoding="utf-8") if line.strip()]
cat_counts = Counter(r.get("cat_id") for r in rows)
sup_counts = Counter(r.get("support_level") for r in rows)
print(f"Loaded {len(rows)} extracted candidates from {HARVEST_FILE}")
print(" By category:", dict(sorted(cat_counts.items())))
print(" By support_level:", dict(sup_counts))
if __name__ == "__main__":
main()