class_docstr: DatasetBuilder for asqa dataset.
docstr: Yields examples.
docstr_tok: ["Yields","examples","."]
code: def _generate_examples(self, split_samples):
      """Yields examples."""
  
      def _add_feature(tfds_sample, split_sample, key):
          value = split_sample[key] if split_sample[key] else ""
          tfds_sample[key] = value
  
      def _iterate_and_add_features_in_dict(
          raw_sample_element, tfds_sample_element, feature_list
      ):
          for element in raw_sample_element:
              tfds_dict = {}
              for feature in feature_list:
                  _add_feature(tfds_dict, element, feature)
              tfds_sample_element.append(tfds_dict)
  
      for sample_id, split_sample in split_samples.items():
          tfds_sample = {
              "sample_id": sample_id,
              "ambiguous_question": split_sample["ambiguous_question"],
              "qa_pairs": [],
              "wikipages": [],
              "annotations": [],
          }
  
          # Add QA pairs.
          _iterate_and_add_features_in_dict(
              raw_sample_element=split_sample["qa_pairs"],
              tfds_sample_element=tfds_sample["qa_pairs"],
              feature_list=[
                  "question",
                  "short_answers",
                  "context",
                  "wikipage",
              ],
          )
  
          # Add Wikipages.
          for _, wikipage_info in split_sample["wikipages"].items():
              tfds_wikipage = {}
              _add_feature(tfds_wikipage, wikipage_info, "title")
              _add_feature(tfds_wikipage, wikipage_info, "url")
              tfds_sample["wikipages"].append(tfds_wikipage)
  
          # Add annotations.
          for annotation in split_sample["annotations"]:
              tfds_annotation = {}
              _add_feature(tfds_annotation, annotation, "long_answer")
              tfds_annotation["knowledge"] = []
              _iterate_and_add_features_in_dict(
                  raw_sample_element=annotation["knowledge"],
                  tfds_sample_element=tfds_annotation["knowledge"],
                  feature_list=["content", "wikipage"],
              )
              tfds_sample["annotations"].append(tfds_annotation)
  
          yield sample_id, tfds_sample
  
file_path: datasets/tensorflow_datasets/datasets/asqa/asqa_dataset_builder.py
imports: import json
  import numpy
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  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(split_samples) without return types