| """ | |
| AdaptaAI Migrant Onboarding Dataset — load examples | |
| """ | |
| # Option 1: Load via HuggingFace datasets library | |
| # pip install datasets | |
| from datasets import load_dataset | |
| # Load the full Q&A dataset | |
| dataset = load_dataset("adapta-ai/migrant-onboarding-qa", split="train") | |
| print(f"Train size: {len(dataset)}") | |
| print(dataset[0]) | |
| # Option 2: Manual JSONL read (no extra dependencies) | |
| import json | |
| from pathlib import Path | |
| qa_path = Path("data/qa.jsonl") | |
| with qa_path.open(encoding="utf-8") as f: | |
| records = [json.loads(line) for line in f if line.strip()] | |
| print(f"Total Q&A records: {len(records)}") | |
| # Filter by language | |
| hindi_qs = [r for r in records if r["language"] in ("hi", "hi_roman")] | |
| print(f"Hindi questions: {len(hindi_qs)}") | |
| # Filter by category | |
| docs_qs = [r for r in records if r["category"] == "documents"] | |
| print(f"Documents category: {len(docs_qs)}") | |
| # Show sample | |
| print("\nSample record:") | |
| print(json.dumps(records[0], ensure_ascii=False, indent=2)) | |