class_docstr: IMDB movie reviews dataset.
docstr: Generate IMDB examples.
code: def _generate_examples(self, archive, directory, labeled=True):
      """Generate IMDB examples."""
      # For labeled examples, extract the label from the path.
      reg_path = "(?P<label>neg|pos)" if labeled else "unsup"
      reg = re.compile(
          os.path.join("^%s" % directory, reg_path, "").replace(
              "\\", "\\\\"
          )
      )
      for path, imdb_f in archive:
          res = reg.match(path)
          if not res:
              continue
          text = imdb_f.read().strip()
          label = res.groupdict()["label"] if labeled else -1
          yield path, {
              "text": text,
              "label": label,
          }
  
file_path: datasets/tensorflow_datasets/datasets/imdb_reviews/imdb_reviews_dataset_builder.py
imports: import os
  import re
  import tensorflow_datasets.public_api
label_desc: Use image node_id 4 for calling the Builder obj's underlying member method code with example usage: obj._generate_examples(archive, directory, labeled) without return types