Datasets:
Modalities:
Text
Formats:
json
Size:
100K - 1M
Tags:
persian
model-behavior
instruction-following
intent-understanding
constraint-following
safe-response-evaluation
License:
| #!/usr/bin/env python3 | |
| import json, sys | |
| from pathlib import Path | |
| required = ['id','dataset','version','split','language','domain','scenario_type','raw_user_message','normalized_user_intent','intent','constraints','ambiguity','expected_model_behavior','bad_model_behavior','ideal_response','evaluation','metadata'] | |
| def validate(path): | |
| errors = 0 | |
| total = 0 | |
| with open(path, 'r', encoding='utf-8') as f: | |
| for line_no, line in enumerate(f, 1): | |
| total += 1 | |
| try: | |
| obj = json.loads(line) | |
| except Exception as e: | |
| print(f'JSON error at line {line_no}: {e}') | |
| errors += 1 | |
| continue | |
| missing = [k for k in required if k not in obj] | |
| if missing: | |
| print(f'Missing {missing} at line {line_no}') | |
| errors += 1 | |
| print(f'Validated {total} records from {path}. Errors: {errors}') | |
| return errors | |
| if __name__ == '__main__': | |
| if len(sys.argv) < 2: | |
| print('Usage: python tools/validate_jsonl.py data/train.jsonl') | |
| raise SystemExit(1) | |
| raise SystemExit(validate(sys.argv[1])) | |