Datasets:
Download scripts/extract_candidates.py from ulamai/UnsolvedAstronomy: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/datasets/ulamai/UnsolvedAstronomy/resolve/main/scripts/extract_candidates.py
- Command line
-
hf download hf://datasets/ulamai/UnsolvedAstronomy/scripts/extract_candidates.py
-
curl -L -o extract_candidates.py https://huggingface.co/datasets/ulamai/UnsolvedAstronomy/resolve/main/scripts/extract_candidates.py
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() | |