class_docstr: The AI2 ARC dataset.
docstr: Yields examples. Compatible with huggingface's `nlp` format.
code: def _generate_examples(self, filepath: str):
      """Yields examples. Compatible with huggingface's `nlp` format."""
      # Generally labels are in the format "A", "B", "C", "D" but sometimes
      # they are in the format "1", "2", "3", "4". We convert the later to the
      # former for consistency.
      n_to_l = dict(zip("1 2 3 4 5".split(), "A B C D E".split()))
      with epath.Path(filepath).open() as f:
          for row in f:
              data = json.loads(row)
              answerkey = n_to_l.get(
                  data["answerKey"], data["answerKey"]
              )
              id_ = data["id"]
              question = data["question"]["stem"]
              choices = data["question"]["choices"]
              text_choices = [choice["text"] for choice in choices]
              label_choices = [
                  n_to_l.get(choice["label"], choice["label"])
                  for choice in choices
              ]
              yield id_, {
                  "id": id_,
                  "answerKey": answerkey,
                  "question": question,
                  "choices": {
                      "text": text_choices,
                      "label": label_choices,
                  },
              }
  
file_path: datasets/tensorflow_datasets/datasets/ai2_arc/ai2_arc_dataset_builder.py
imports: import json
  import os
  from etils import epath
  import tensorflow_datasets.public_api
label_desc: Use image node_id 3 for calling the Builder obj's underlying member method code with example usage: obj._generate_examples(filepath) without return types