def builddata(self, path): """ Build a list of feature list from a given path :type path: string :param path: data path, where all data files are saved """ files = [os.path.join(path, fname) for fname in os.listdir(path) if fname.endswith('.dis')] for fname in files: rst = RSTTree(fname=fname) rst.build() actionlist, samplelist = rst.generate_samples() self.actionlist += actionlist self.samplelist += samplelist
def builddata(self, rpath): """ Build a list of feature list from a given path :type path: string :param path: data path, where all data files are saved """ # Read RST tree file files = [os.path.join(rpath, fname) for fname in os.listdir(rpath) if fname.endswith('.dis')] for fdis in files: print 'Processing data from file: {}'.format(fdis) fmerge = fdis.replace('.dis', '.merge') rst = RSTTree(fdis, fmerge) rst.build() actionlist, samplelist = rst.generate_samples(self.bcvocab) self.actionlist += actionlist self.samplelist += samplelist