code: def getSamples(netDataFile):
      
      try:
        with open(netDataFile) as f:
          reader = csv.reader(f)
          header = next(reader, None)
          next(reader, None)
          resetIdx = next(reader).index("R")
          tokenIdx = header.index("_token")
          catIdx = header.index("_category")
          idIdx = header.index("ID")
  
          currentSample = []
          samples = OrderedDict()
          for line in reader:
            if int(line[resetIdx]) == 1:
              if len(currentSample) != 0:
                samples[line[idIdx]] = ([" ".join(currentSample)],
                                        [int(c) for c in line[catIdx].split(" ")])
              currentSample = [line[tokenIdx]]
            else:
              currentSample.append(line[tokenIdx])
          samples[line[idIdx]] = ([" ".join(currentSample)],
                                  [int(c) for c in line[catIdx].split(" ")])
  
          return samples
  
      except IOError as e:
        print "Could not open the file {}.".format(netDataFile)
        raise e
docs: Returns samples joined at reset points.
      @param netDataFile  (str)         Path to file (in the FileRecordStream
                                        format).
      @return samples     (OrderedDict) Keys are sample number (in order they are
                                        read in). Values are two-tuples of sample
                                        text and category ints.