class_docstr: HEAD-QA: A Healthcare Dataset for Complex Reasoning
docstr: Yields examples.
docstr_tok: ["Yields","examples","."]
code: def _generate_examples(self, data_dir, filepath):
      """Yields examples."""
      with open(filepath, encoding="utf-8") as f:
          head_qa = json.load(f)
          for exam_id, exam in enumerate(head_qa["exams"]):
              content = head_qa["exams"][exam]
              name = content["name"].strip()
              year = content["year"].strip()
              category = content["category"].strip()
              for question in content["data"]:
                  qid = int(question["qid"].strip())
                  qtext = question["qtext"].strip()
                  ra = int(question["ra"].strip())
  
                  aids = [
                      answer["aid"] for answer in question["answers"]
                  ]
                  atexts = [
                      answer["atext"].strip()
                      for answer in question["answers"]
                  ]
                  answers = [
                      {"aid": aid, "atext": atext}
                      for aid, atext in zip(aids, atexts)
                  ]
  
                  id_ = f"{exam_id}_{qid}"
                  yield id_, {
                      "name": name,
                      "year": year,
                      "category": category,
                      "qid": qid,
                      "qtext": qtext,
                      "ra": ra,
                      "answers": answers,
                  }
  
file_path: lm-evaluation-harness/lm_eval/datasets/headqa/headqa.py
imports: import json
  import os
  import datasets
label_desc: Use image node_id 3 for calling the HeadQA obj's underlying member method code with example usage: obj._generate_examples(data_dir, filepath) without return types