Download malformed_fields.py from terraphim/fof-bench-lexical-baseline: direct link, hf CLI and curl.
- Browser
- Download file 842 Bytes
-
https://huggingface.co/datasets/terraphim/fof-bench-lexical-baseline/resolve/main/malformed_fields.py
- Command line
-
hf download hf://datasets/terraphim/fof-bench-lexical-baseline/malformed_fields.py
-
curl -L -o malformed_fields.py https://huggingface.co/datasets/terraphim/fof-bench-lexical-baseline/resolve/main/malformed_fields.py
842 Bytes
| # Count FOF-Bench fields that are not strings, per split. | |
| # Usage: uv run --no-project python -I malformed_fields.py <dir with train.jsonl val.jsonl test.jsonl> | |
| import collections, csv, json, os, sys | |
| d = sys.argv[1] | |
| w = csv.writer(sys.stdout) | |
| w.writerow(["split", "rows", "nonstring_anchor", "nonstring_positive", "nonstring_negative", "objects_with_plan_key"]) | |
| for split in ("train", "val", "test"): | |
| rows = 0; bad = collections.Counter(); plan = 0 | |
| for line in open(os.path.join(d, f"{split}.jsonl"), encoding="utf-8"): | |
| r = json.loads(line); rows += 1 | |
| for f in ("anchor", "positive", "negative"): | |
| if not isinstance(r[f], str): | |
| bad[f] += 1 | |
| plan += isinstance(r[f], dict) and "plan" in r[f] | |
| w.writerow([split, rows, bad["anchor"], bad["positive"], bad["negative"], plan]) | |