Datasets:
Download scripts/sample_for_review.py from hal9/ai-app-cloud-deploy-issues: direct link, hf CLI and curl.
- Browser
- Download file 1.2 kB
-
https://huggingface.co/datasets/hal9/ai-app-cloud-deploy-issues/resolve/main/scripts/sample_for_review.py
- Command line
-
hf download hf://datasets/hal9/ai-app-cloud-deploy-issues/scripts/sample_for_review.py
-
curl -L -o sample_for_review.py https://huggingface.co/datasets/hal9/ai-app-cloud-deploy-issues/resolve/main/scripts/sample_for_review.py
1.2 kB
| #!/usr/bin/env python3 | |
| """Random sample of coded threads for manual review (local only; prints titles/excerpts). | |
| Usage: python3 -I scripts/sample_for_review.py coded_kw.jsonl N [seed] [--exclude judgement.csv ...] | |
| Prints one block per thread plus a CSV header to fill in manual/judgement_full.csv (keyed by url).""" | |
| import json, random, sys, csv | |
| args = sys.argv[1:] | |
| excl = set() | |
| if "--exclude" in args: | |
| i = args.index("--exclude") | |
| for p in args[i + 1:]: | |
| excl |= {r.get("url") for r in csv.DictReader(open(p)) if r.get("url")} | |
| args = args[:i] | |
| coded = [json.loads(l) for l in open(args[0])] | |
| n, seed = int(args[1]), int(args[2]) if len(args) > 2 else 20261028 | |
| pool = [c for c in coded if c["url"] not in excl] | |
| random.Random(seed).shuffle(pool) | |
| for c in pool[:n]: | |
| print(f'{c["url"]} [{c["state"]}/{c["state_reason"]}] T: {c["title"]}') | |
| print(f' E: {c["excerpt_private"]}') | |
| print(f' KW rel={c["kw_relevant"]} host={c["kw_target_host"]} app={c["kw_app_type"]} fw={c["kw_framework"]} ' | |
| f'prov={c["kw_model_provider"]} cat={c["kw_topic"]} err={c["kw_error_type"]} ' | |
| f'res={c["kw_resolution_type"]} aigen={c["kw_ai_generated_app"]}/{c["kw_ai_tool"]}') | |