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: Parse bAbI data into stories, queries, and answers.
  
  Arguments:
      babi_data (string): String of bAbI data.
      babi_file (string): Filename with bAbI data.
  
  Returns:
      list of tuples : List of (story, query, answer) words.
docstr_tok: ["Parse","bAbI","data","into","stories",",","queries",",","and","answers",".","Arguments",":","babi_data","(","string",")",":","String","of","bAbI","data",".","babi_file","(","string",")",":","Filename","with","bAbI","data",".","Returns",":","list","of","tuples",":","List","of","(","story",",","query",",","answer",")","words","."]
code: def parse_babi(babi_file):
      """
      Parse bAbI data into stories, queries, and answers.
  
      Arguments:
          babi_data (string): String of bAbI data.
          babi_file (string): Filename with bAbI data.
  
      Returns:
          list of tuples : List of (story, query, answer) words.
      """
      babi_data = open(babi_file).read()
      lines = BABI.data_to_list(babi_data)
  
      data, story = [], []
      for line in lines:
          nid, line = line.split(" ", 1)
          if int(nid) == 1:
              story = []
          if "\t" in line:
              q, a, supporting = line.split("\t")
              substory = [x for x in story if x]
              data.append((substory, BABI.tokenize(q), a))
              story.append("")
          else:
              sent = BABI.tokenize(line)
              story.append(sent)
  
      return [
          (BABI.flatten(_story), _question, answer)
          for _story, _question, answer in data
      ]
  
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 6 for calling the BABI obj's underlying member method code with example usage: obj.parse_babi(babi_file) and returns: unknown