class_docstr: DatasetBuilder for a *-CFQ split.
class_docstr_tok: ["DatasetBuilder","for","a","*","-CFQ","split","."]
docstr: Yields examples.
docstr_tok: ["Yields","examples","."]
code: def _generate_examples(self, dataset_paths, split_path, split_id):
      """Yields examples."""
      if self.builder_config.compound_divergence:
          samples_path = os.path.join(
              dataset_paths[_UCFQ_POOL], "dataset.json"
          )
          with epath.Path(samples_path).open() as samples_file:
              logging.info(
                  "Reading json from %s into memory...", samples_path
              )
              samples = json.loads(samples_file.read())
              logging.info("%d samples loaded", len(samples))
              with epath.Path(split_path).open() as split_file:
                  splits = json.loads(split_file.read())
                  for idx in splits[split_id]:
                      sample = samples[idx]
                      yield idx, {
                          _QUESTION: sample[_QUESTION_FIELD],
                          _QUERY: sample[_QUERY_FIELD],
                      }
      else:
          with epath.Path(split_path).open() as sf:
              split_config = json.load(sf)
          slice_index = 0
          for dss in split_config[split_id]:
              previous_shard = -1
              pool = None
              dataset = dss["dataset"]
              if dataset not in dataset_paths:
                  logging.error("Unexpected dataset %s", dataset)
                  continue
              pool_path = dataset_paths[dataset]
              for rng in dss["indices"]:
                  start = int(rng["startIndex"])
                  end = int(rng["endIndex"])
                  for s in _get_dataset_slices(start, end):
                      if previous_shard != s.shard_index:
                          pool = _read_pool_shard(
                              pool_path, s.shard_index
                          )
                          previous_shard = s.shard_index
                      for idx in range(s.range_begin, s.range_end):
                          absolute_index = (
                              s.shard_index * _SHARD_SIZE + idx
                          )
                          # The slice_index is also part of the key because overweighting
                          # splits use the same example multiple times and the key must
                          # be unique for each instance.
                          key = f"{dataset}-{absolute_index}-{slice_index}"
                          yield key, {
                              _QUESTION: pool[idx][_QUESTION_FIELD],
                              _QUERY: pool[idx][_QUERY_FIELD],
                          }
                      slice_index += 1
  
imports: import json
  import os
  from absl import logging
  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(dataset_paths, split_path, split_id) without return types