class_docstr: Booksum dataset builder.
docstr: Yields examples.
docstr_tok: ["Yields","examples","."]
code: def _generate_examples(
      self,
      alignments_path: tfds.typing.PathLike,
      base_path: tfds.typing.PathLike,
      granularity: Text,
  ) -> Iterator[Tuple[Text, Dict[Text, Text]]]:
      """Yields examples."""
      with tf.io.gfile.GFile(alignments_path, "r") as f:
          for i, line in enumerate(f.read().strip().splitlines()):
              example_data = json.loads(line)
              input_path = os.path.join(
                  base_path, example_data[f"{granularity}_path"]
              )
              summary_path = os.path.join(
                  base_path,
                  "booksum",
                  "scripts",
                  example_data["summary_path"],
              )
              if not tf.io.gfile.exists(input_path):
                  logging.info("Skipping missing input: %s", input_path)
                  continue
              if not tf.io.gfile.exists(summary_path):
                  logging.info(
                      "Skipping missing summary: %s", summary_path
                  )
                  continue
              with tf.io.gfile.GFile(input_path, "r") as f:
                  input_text = f.read().strip()
              with tf.io.gfile.GFile(summary_path, "r") as f:
                  summary_text = " ".join(
                      json.loads(f.read())["summary"]
                  ).strip()
              yield str(i), {
                  _DOCUMENT: input_text,
                  _SUMMARY: summary_text,
              }
  
file_path: datasets/tensorflow_datasets/datasets/booksum/booksum_dataset_builder.py
imports: import json
  import logging
  import os
  from typing import Dict, Iterator, Text, Tuple
  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(alignments_path, base_path, granularity) without return types