# Count FOF-Bench fields that are not strings, per split. # Usage: uv run --no-project python -I malformed_fields.py 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])