class_docstr: Jigsaw toxicity dataset; see https://www.tensorflow.org/datasets/catalog/wikipedia_toxicity_subtypes.
class_docstr_tok: ["Jigsaw","toxicity","dataset",";","see","https",":","\/\/www.tensorflow.org\/datasets\/catalog\/wikipedia_toxicity_subtypes","."]
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):
      """Dataset constructor, loads the data into memory."""
      raw_examples = load_tfds(
          "wikipedia_toxicity_subtypes", split=split
      )
      self._examples = []  # populate this with data records
      for record in raw_examples:
          self._examples.append(
              {
                  "sentence": record["text"].decode("utf-8"),
                  "label": self.LABELS[int(record["toxicity"])],
                  "identity_attack": bool(
                      int(record["identity_attack"])
                  ),
                  "insult": bool(int(record["insult"])),
                  "obscene": bool(int(record["obscene"])),
                  "severe_toxicity": bool(
                      int(record["severe_toxicity"])
                  ),
                  "threat": bool(int(record["threat"])),
              }
          )
  
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 ToxicityData object from inherited base classes: lit_dataset with example: obj = ToxicityData(split, max_seq_len)