Exemple #1
0
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