class_docstr: This class loads in the Facebook bAbI dataset and vectorizes them into stories,
  questions, and answers as described in:
  "Towards AI-Complete Question Answering: A Set of Prerequisite Toy Tasks"
  http://arxiv.org/abs/1502.05698.
class_docstr_tok: ["This","class","loads","in","the","Facebook","bAbI","dataset","and","vectorizes","them","into","stories",",","questions",",","and","answers","as","described","in",":","''","Towards","AI-Complete","Question","Answering",":","A","Set","of","Prerequisite","Toy","Tasks","''","http",":","\/\/arxiv.org\/abs\/1502.05698","."]
docstr: Load bAbI dataset and extract text and read the stories
  For a particular task, the class will read both train and test files
  and combine the vocabulary.
  
  Arguments:
      path (str): Directory to store the dataset
      task (str): a particular task to solve (all bAbI tasks are train
                  and tested separately)
      subset (str): subset of the dataset to use:
                    {en, en-10k, shuffled, hn, hn-10k, shuffled-10k}
docstr_tok: ["Load","bAbI","dataset","and","extract","text","and","read","the","stories","For","a","particular","task",",","the","class","will","read","both","train","and","test","files","and","combine","the","vocabulary",".","Arguments",":","path","(","str",")",":","Directory","to","store","the","dataset","task","(","str",")",":","a","particular","task","to","solve","(","all","bAbI","tasks","are","train","and","tested","separately",")","subset","(","str",")",":","subset","of","the","dataset","to","use",":","{","en",",","en-10k",",","shuffled",",","hn",",","hn-10k",",","shuffled-10k","}"]
code: def __init__(
      self, path=".", task="qa1_single-supporting-fact", subset="en"
  ):
      """
      Load bAbI dataset and extract text and read the stories
      For a particular task, the class will read both train and test files
      and combine the vocabulary.
  
      Arguments:
          path (str): Directory to store the dataset
          task (str): a particular task to solve (all bAbI tasks are train
                      and tested separately)
          subset (str): subset of the dataset to use:
                        {en, en-10k, shuffled, hn, hn-10k, shuffled-10k}
      """
      url = "http://www.thespermwhale.com/jaseweston/babi"
      size = 11745123
      filename = "tasks_1-20_v1-2.tar.gz"
      super(BABI, self).__init__(filename, url, size, path=path)
      self.task = task
      self.subset = subset
  
      neon_logger.display(
          "Preparing bAbI dataset or extracting from %s" % path
      )
      neon_logger.display("Task is %s/%s" % (subset, task))
      self.tasks = [
          "qa1_single-supporting-fact",
          "qa2_two-supporting-facts",
          "qa3_three-supporting-facts",
          "qa4_two-arg-relations",
          "qa5_three-arg-relations",
          "qa6_yes-no-questions",
          "qa7_counting",
          "qa8_lists-sets",
          "qa9_simple-negation",
          "qa10_indefinite-knowledge",
          "qa11_basic-coreference",
          "qa12_conjunction",
          "qa13_compound-coreference",
          "qa14_time-reasoning",
          "qa15_basic-deduction",
          "qa16_basic-induction",
          "qa17_positional-reasoning",
          "qa18_size-reasoning",
          "qa19_path-finding",
          "qa20_agents-motivations",
      ]
      assert task in self.tasks, "given task is not in the bAbI dataset"
  
      self.train_file, self.test_file = self.load_data(path, task)
      self.train_parsed = BABI.parse_babi(self.train_file)
      self.test_parsed = BABI.parse_babi(self.test_file)
  
      self.compute_statistics()
      self.train = self.vectorize_stories(self.train_parsed)
      self.test = self.vectorize_stories(self.test_parsed)
  
imports: from builtins import map
  import numpy
  import os
  import re
  import tarfile
  from neon import logger
  from neon.data.dataiterator import NervanaDataIterator
  from neon.data.datasets import Dataset
  from neon.data.text_preprocessing import pad_sentences
  from functools import reduce
label_desc: Use image node_id 1 to create a new BABI object from inherited base classes: Dataset with example: obj = BABI(path, task, subset)