code: def _parse(file, only_supporting):
      data, story = [], []
      for line in file:
          tid, text = line.rstrip("\n").split(" ", 1)
          if tid == "1":
              story = []
          # sentence
          if text.endswith("."):
              story.append(text[:-1])
          # question
          else:
              # remove any leading or trailing whitespace after splitting
              query, answer, supporting = (
                  x.strip() for x in text.split("\t")
              )
              if only_supporting:
                  substory = [
                      story[int(i) - 1] for i in supporting.split()
                  ]
              else:
                  substory = [x for x in story if x]
              data.append((substory, query[:-1], answer))  # remove '?'
              story.append("")
      return data
  
file_path: pytext/pytext/legacy/datasets/babi.py
imports: import os
  from io import open
  import torch
  from ..data import Dataset, Example, Field, Iterator
label_desc: Use image node_id 2 for calling the BABI20 obj's underlying member method code with example usage: obj._parse(file, only_supporting) and returns: data