def initialize(self): """Initialize all the relevant objects for the run.""" self.corpus = Corpus(self.dataDir) self.corpusLabel = CorpusLabel(path=self.labelPath, corpus=self.corpus) with open(self.profilesPath) as p: self.profiles = json.load(p)
def main(args): if not args.absolutePaths: dataDir = os.path.join(root, args.dataDir) labelDir = os.path.join(root, args.labelDir) else: dataDir = args.dataDir labelDir = args.labelDir # The following params are used in NAB scoring, but defined here because they # impact the labeling process -- i.e. windows cannot exist in the probationary # period. windowSize = 0.10 probationaryPercent = 0.15 print "Getting Corpus" corpus = Corpus(dataDir) print "Creating LabelCombiner" labelCombiner = LabelCombiner(labelDir, corpus, args.threshold, windowSize, probationaryPercent, args.verbosity) print "Combining Labels" labelCombiner.combine() print "Writing combined labels files" labelCombiner.write(args.combinedLabelsPath, args.combinedWindowsPath) print "Attempting to load objects as a test" corpusLabel = CorpusLabel(args.combinedWindowsPath, corpus) corpusLabel.validateLabels() print "Successfully combined labels!" print "Resulting windows stored in:", args.combinedWindowsPath
def main(args): if not args.absolutePaths: args.labelDir = os.path.join(root, args.labelDir) args.dataDir = os.path.join(root, args.dataDir) args.destDir = os.path.join(root, args.destDir) if not checkInputs(args): return corpus = Corpus(args.dataDir) corpusLabel = CorpusLabel(args.labelDir, corpus=corpus) corpusLabel.getEverything() columnData = {} for relativePath in corpusLabel.labels.keys(): columnData[relativePath] = pandas.Series( corpusLabel.labels[relativePath]["label"]) corpus.addColumn("label", columnData) corpus.copy(newRoot=args.destDir) print "Done adding labels!"
def main(args): if args.create: createApplication() if args.start: startApplication() if args.stop: stopApplication() if args.file: corpus = Corpus(args.data) labels = CorpusLabel(path=args.labels, corpus=corpus) streamFile(corpus, labels, args.results, args.file) if args.stream: corpus = Corpus(args.data) labels = CorpusLabel(path=args.labels, corpus=corpus) streamAll(corpus, labels, args.results) if args.delete: deleteApplication()