class_docstr: IMDB reviews dataset; see http://ai.stanford.edu/~amaas/data/sentiment/.
class_docstr_tok: ["IMDB","reviews","dataset",";","see","http",":","\/\/ai.stanford.edu\/~amaas\/data\/sentiment\/","."]
docstr: Dataset constructor, loads the data into memory.
docstr_tok: ["Dataset","constructor",",","loads","the","data","into","memory","."]
code: def __init__(
      self,
      split="test",
      max_seq_len=500,
      max_examples: Optional[int] = None,
  ):
      """Dataset constructor, loads the data into memory."""
      raw_examples = load_tfds("imdb_reviews", split=split)
      self._examples = []  # populate this with data records
      for record in raw_examples[:max_examples]:
          # format and truncate from the end to max_seq_len tokens.
          truncated_text = " ".join(
              record["text"]
              .decode("utf-8")
              .replace("<br />", "")
              .split()[-max_seq_len:]
          )
          self._examples.append(
              {
                  "text": truncated_text,
                  "label": self.LABELS[record["label"]],
              }
          )
  
imports: from typing import Optional
  from absl import logging
  from lit_nlp.api import dataset
  from lit_nlp.api import types
  import pandas
  import tensorflow_datasets
label_desc: Use image node_id 1 to create a new IMDBData object from inherited base classes: lit_dataset with example: obj = IMDBData(split, max_seq_len, max_examples)