chemistry-knowledge / examples /read_dataset.py
janwein's picture
Release ChemBricks curated knowledge 2026-09-17.1
7943e63 verified
Raw History Blame Contribute Delete
738 Bytes
"""Read the release with Python's standard library."""
import argparse
import json
from pathlib import Path
root = Path(__file__).resolve().parents[1]
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--record-id")
args = parser.parse_args()
with (root / "data/records.jsonl").open() as stream:
for line in stream:
record = json.loads(line)
if args.record_id is None or record["record_id"] == args.record_id:
print(record["record_id"])
print(record["beginner_question"])
print(record["answer"])
print("Limitations:", record["limitations"])
break
else:
raise SystemExit("Record not found in the complete-record subset.")