docstr: Create an IMDB dataset instance given a path and fields.
  
  Arguments:
      path: Path to the dataset's highest level directory
      text_field: The field that will be used for text data.
      label_field: The field that will be used for label data.
      Remaining keyword arguments: Passed to the constructor of
          data.Dataset.
docstr_tok: ["Create","an","IMDB","dataset","instance","given","a","path","and","fields",".","Arguments",":","path",":","Path","to","the","dataset","'s","highest","level","directory","text_field",":","The","field","that","will","be","used","for","text","data",".","label_field",":","The","field","that","will","be","used","for","label","data",".","Remaining","keyword","arguments",":","Passed","to","the","constructor","of","data.Dataset","."]
code: def __init__(self, path, text_field, label_field, **kwargs):
      """Create an IMDB dataset instance given a path and fields.
  
      Arguments:
          path: Path to the dataset's highest level directory
          text_field: The field that will be used for text data.
          label_field: The field that will be used for label data.
          Remaining keyword arguments: Passed to the constructor of
              data.Dataset.
      """
      fields = [("text", text_field), ("label", label_field)]
      examples = []
  
      for label in ["pos", "neg"]:
          for fname in glob.iglob(os.path.join(path, label, "*.txt")):
              with open(fname, "r") as f:
                  text = f.readline()
              examples.append(
                  data.Example.fromlist([text, label], fields)
              )
  
      super(IMDb, self).__init__(examples, fields, **kwargs)
  
file_path: decanlp/text/torchtext/datasets/imdb.py
imports: import os
  import glob
  from ..None import data
label_desc: Use image node_id 2 to create a new IMDb object from inherited base classes: data with example: obj = IMDb(path, text_field, label_field)