Examples of ArgumentBuilder


Examples of org.apache.commons.cli2.builder.ArgumentBuilder

  private static Option buildOption(String name,
                                    String shortName,
                                    String description,
                                    boolean required,
                                    String defaultValue) {
    ArgumentBuilder argBuilder = new ArgumentBuilder().withName(name).withMinimum(1).withMaximum(1);
    if (defaultValue != null) {
      argBuilder = argBuilder.withDefault(defaultValue);
    }
    Argument arg = argBuilder.create();
    return new DefaultOptionBuilder().withLongName(name).withRequired(required).withShortName(shortName)
        .withArgument(arg).withDescription(description).create();
  }
View Full Code Here

Examples of org.apache.commons.cli2.builder.ArgumentBuilder

 
  private SparseVectorsFromSequenceFiles() {}
 
  public static void main(String[] args) throws Exception {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
   
    Option inputDirOpt = obuilder.withLongName("input").withRequired(true).withArgument(
      abuilder.withName("input").withMinimum(1).withMaximum(1).create()).withDescription(
      "input dir containing the documents in sequence file format").withShortName("i").create();
   
    Option outputDirOpt = obuilder.withLongName("output").withRequired(true).withArgument(
      abuilder.withName("output").withMinimum(1).withMaximum(1).create()).withDescription(
      "The output directory").withShortName("o").create();
    Option minSupportOpt = obuilder.withLongName("minSupport").withArgument(
      abuilder.withName("minSupport").withMinimum(1).withMaximum(1).create()).withDescription(
      "(Optional) Minimum Support. Default Value: 2").withShortName("s").create();
   
    Option analyzerNameOpt = obuilder.withLongName("analyzerName").withArgument(
      abuilder.withName("analyzerName").withMinimum(1).withMaximum(1).create()).withDescription(
      "The class name of the analyzer").withShortName("a").create();
   
    Option chunkSizeOpt = obuilder.withLongName("chunkSize").withArgument(
      abuilder.withName("chunkSize").withMinimum(1).withMaximum(1).create()).withDescription(
      "The chunkSize in MegaBytes. 100-10000 MB").withShortName("chunk").create();
   
    Option weightOpt = obuilder.withLongName("weight").withRequired(false).withArgument(
      abuilder.withName("weight").withMinimum(1).withMaximum(1).create()).withDescription(
      "The kind of weight to use. Currently TF or TFIDF").withShortName("wt").create();
   
    Option minDFOpt = obuilder.withLongName("minDF").withRequired(false).withArgument(
      abuilder.withName("minDF").withMinimum(1).withMaximum(1).create()).withDescription(
      "The minimum document frequency.  Default is 1").withShortName("md").create();
   
    Option maxDFPercentOpt = obuilder.withLongName("maxDFPercent").withRequired(false).withArgument(
      abuilder.withName("maxDFPercent").withMinimum(1).withMaximum(1).create()).withDescription(
      "The max percentage of docs for the DF.  Can be used to remove really high frequency terms."
          + " Expressed as an integer between 0 and 100. Default is 99.").withShortName("x").create();
   
    Option minLLROpt = obuilder.withLongName("minLLR").withRequired(false).withArgument(
      abuilder.withName("minLLR").withMinimum(1).withMaximum(1).create()).withDescription(
      "(Optional)The minimum Log Likelihood Ratio(Float)  Default is " + LLRReducer.DEFAULT_MIN_LLR)
        .withShortName("ml").create();
   
    Option numReduceTasksOpt = obuilder.withLongName("numReducers").withArgument(
      abuilder.withName("numReducers").withMinimum(1).withMaximum(1).create()).withDescription(
      "(Optional) Number of reduce tasks. Default Value: 1").withShortName("nr").create();
   
    Option powerOpt = obuilder.withLongName("norm").withRequired(false).withArgument(
      abuilder.withName("norm").withMinimum(1).withMaximum(1).create()).withDescription(
      "The norm to use, expressed as either a float or \"INF\" if you want to use the Infinite norm.  "
          + "Must be greater or equal to 0.  The default is not to normalize").withShortName("n").create();
    Option maxNGramSizeOpt = obuilder.withLongName("maxNGramSize").withRequired(false).withArgument(
      abuilder.withName("ngramSize").withMinimum(1).withMaximum(1).create())
        .withDescription(
          "(Optional) The maximum size of ngrams to create"
              + " (2 = bigrams, 3 = trigrams, etc) Default Value:2").withShortName("ng").create();
    Option sequentialAccessVectorOpt = obuilder.withLongName("sequentialAccessVector").withRequired(false)
        .withDescription(
View Full Code Here

Examples of org.apache.commons.cli2.builder.ArgumentBuilder

    driver.runJob(dir, outputDir, params);
  }
 
  public static void main(String[] args) throws Exception {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
   
    Option helpOpt = DefaultOptionCreator.helpOption();
   
    Option inputDirOpt = obuilder.withLongName("input").withRequired(true).withArgument(
      abuilder.withName("input").withMinimum(1).withMaximum(1).create()).withDescription(
      "The Directory on HDFS containing the collapsed, properly formatted files").withShortName("i").create();
   
    Option outputOpt = obuilder.withLongName("output").withRequired(true).withArgument(
      abuilder.withName("output").withMinimum(1).withMaximum(1).create()).withDescription(
      "The location of the modelon the HDFS").withShortName("o").create();
   
    Option gramSizeOpt = obuilder.withLongName("gramSize").withRequired(true).withArgument(
      abuilder.withName("gramSize").withMinimum(1).withMaximum(1).create()).withDescription(
      "Size of the n-gram. Default Value: 1 ").withShortName("ng").create();
   
    Option alphaOpt = obuilder.withLongName("alpha").withRequired(false).withArgument(
      abuilder.withName("a").withMinimum(1).withMaximum(1).create()).withDescription(
      "Smoothing parameter Default Value: 1.0").withShortName("a").create();
   
    Option typeOpt = obuilder.withLongName("classifierType").withRequired(true).withArgument(
      abuilder.withName("classifierType").withMinimum(1).withMaximum(1).create()).withDescription(
      "Type of classifier: bayes|cbayes. Default: bayes").withShortName("type").create();
    Option dataSourceOpt = obuilder.withLongName("dataSource").withRequired(true).withArgument(
      abuilder.withName("dataSource").withMinimum(1).withMaximum(1).create()).withDescription(
      "Location of model: hdfs|hbase. Default Value: hdfs").withShortName("source").create();
   
    Group group = gbuilder.withName("Options").withOption(gramSizeOpt).withOption(helpOpt).withOption(
      inputDirOpt).withOption(outputOpt).withOption(typeOpt).withOption(dataSourceOpt).withOption(alphaOpt)
        .create();
View Full Code Here

Examples of org.apache.commons.cli2.builder.ArgumentBuilder

  // do nothing
  }
 
  public static void main(String[] args) throws IOException, InvalidDatastoreException {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
   
    Option pathOpt = obuilder.withLongName("model").withRequired(true).withArgument(
      abuilder.withName("model").withMinimum(1).withMaximum(1).create()).withDescription(
      "The path on HDFS / Name of Hbase Table as defined by the -source parameter").withShortName("m")
        .create();
   
    Option dirOpt = obuilder.withLongName("testDir").withRequired(true).withArgument(
      abuilder.withName("testDir").withMinimum(1).withMaximum(1).create()).withDescription(
      "The directory where test documents resides in").withShortName("d").create();
   
    Option helpOpt = DefaultOptionCreator.helpOption();
   
    Option encodingOpt = obuilder.withLongName("encoding").withArgument(
      abuilder.withName("encoding").withMinimum(1).withMaximum(1).create()).withDescription(
      "The file encoding.  Defaults to UTF-8").withShortName("e").create();
   
    Option defaultCatOpt = obuilder.withLongName("defaultCat").withArgument(
      abuilder.withName("defaultCat").withMinimum(1).withMaximum(1).create()).withDescription(
      "The default category Default Value: unknown").withShortName("default").create();
   
    Option gramSizeOpt = obuilder.withLongName("gramSize").withRequired(true).withArgument(
      abuilder.withName("gramSize").withMinimum(1).withMaximum(1).create()).withDescription(
      "Size of the n-gram. Default Value: 1").withShortName("ng").create();
   
    Option alphaOpt = obuilder.withLongName("alpha").withRequired(false).withArgument(
      abuilder.withName("a").withMinimum(1).withMaximum(1).create()).withDescription(
      "Smoothing parameter Default Value: 1.0").withShortName("a").create();
   
    Option verboseOutputOpt = obuilder.withLongName("verbose").withRequired(false).withDescription(
      "Output which values were correctly and incorrectly classified").withShortName("v").create();
   
    Option typeOpt = obuilder.withLongName("classifierType").withRequired(true).withArgument(
      abuilder.withName("classifierType").withMinimum(1).withMaximum(1).create()).withDescription(
      "Type of classifier: bayes|cbayes. Default Value: bayes").withShortName("type").create();
   
    Option dataSourceOpt = obuilder.withLongName("dataSource").withRequired(true).withArgument(
      abuilder.withName("dataSource").withMinimum(1).withMaximum(1).create()).withDescription(
      "Location of model: hdfs|hbase Default Value: hdfs").withShortName("source").create();
   
    Option methodOpt = obuilder.withLongName("method").withRequired(false).withArgument(
      abuilder.withName("method").withMinimum(1).withMaximum(1).create()).withDescription(
      "Method of Classification: sequential|mapreduce. Default Value: sequential").withShortName("method")
        .create();
   
    Group group = gbuilder.withName("Options").withOption(defaultCatOpt).withOption(dirOpt).withOption(
      encodingOpt).withOption(gramSizeOpt).withOption(pathOpt).withOption(typeOpt).withOption(dataSourceOpt)
View Full Code Here

Examples of org.apache.commons.cli2.builder.ArgumentBuilder

 
  private DirichletDriver() {}
 
  public static void main(String[] args) throws Exception {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
   
    Option inputOpt = DefaultOptionCreator.inputOption().create();
    Option outputOpt = DefaultOptionCreator.outputOption().create();
    Option maxIterOpt = DefaultOptionCreator.maxIterOption().create();
    Option topicsOpt = DefaultOptionCreator.kOption().create();
    Option helpOpt = DefaultOptionCreator.helpOption();
   
    Option mOpt = obuilder.withLongName("alpha").withRequired(true).withShortName("m").withArgument(
      abuilder.withName("alpha").withMinimum(1).withMaximum(1).create()).withDescription(
      "The alpha0 value for the DirichletDistribution.").create();
   
    Option modelOpt = obuilder.withLongName("modelClass").withRequired(true).withShortName("d").withArgument(
      abuilder.withName("modelClass").withMinimum(1).withMaximum(1).create()).withDescription(
      "The ModelDistribution class name. "
          + "Defaults to org.apache.mahout.clustering.dirichlet.models.NormalModelDistribution").create();
   
    Option prototypeOpt = obuilder.withLongName("modelPrototypeClass").withRequired(false).withShortName("p")
        .withArgument(abuilder.withName("prototypeClass").withMinimum(1).withMaximum(1).create())
        .withDescription(
          "The ModelDistribution prototype Vector class name. "
              + "Defaults to org.apache.mahout.math.RandomAccessSparseVector").create();
   
    Option sizeOpt = obuilder.withLongName("prototypeSize").withRequired(true).withShortName("s")
        .withArgument(abuilder.withName("prototypeSize").withMinimum(1).withMaximum(1).create())
        .withDescription("The ModelDistribution prototype Vector size. ").create();
   
    Option numRedOpt = obuilder.withLongName("maxRed").withRequired(true).withShortName("r").withArgument(
      abuilder.withName("maxRed").withMinimum(1).withMaximum(1).create()).withDescription(
      "The number of reduce tasks.").create();
   
    Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(outputOpt)
        .withOption(modelOpt).withOption(prototypeOpt).withOption(sizeOpt).withOption(maxIterOpt).withOption(
          mOpt).withOption(topicsOpt).withOption(helpOpt).withOption(numRedOpt).create();
View Full Code Here

Examples of org.apache.commons.cli2.builder.ArgumentBuilder

 
  private CanopyDriver() { }
 
  public static void main(String[] args) throws IOException {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
   
    Option inputOpt = obuilder.withLongName("input").withRequired(true).withArgument(
      abuilder.withName("input").withMinimum(1).withMaximum(1).create()).withDescription(
      "The Path for input Vectors. Must be a SequenceFile of Writable, Vector").withShortName("i").create();
   
    Option outputOpt = obuilder.withLongName("output").withRequired(true).withArgument(
      abuilder.withName("output").withMinimum(1).withMaximum(1).create()).withDescription(
      "The Path to put the output in").withShortName("o").create();
   
    Option measureClassOpt = obuilder.withLongName("distance").withRequired(false).withArgument(
      abuilder.withName("distance").withMinimum(1).withMaximum(1).create()).withDescription(
      "The Distance Measure to use.  Default is SquaredEuclidean").withShortName("m").create();
   
    Option vectorClassOpt = obuilder.withLongName("vectorClass").withRequired(false).withArgument(
      abuilder.withName("vectorClass").withMinimum(1).withMaximum(1).create()).withDescription(
      "The Vector implementation class name.  Default is RandomAccessSparseVector.class").withShortName("v")
        .create();
    Option t1Opt = obuilder.withLongName("t1").withRequired(true).withArgument(
      abuilder.withName("t1").withMinimum(1).withMaximum(1).create()).withDescription("t1").withShortName(
      "t1").create();
    Option t2Opt = obuilder.withLongName("t2").withRequired(true).withArgument(
      abuilder.withName("t2").withMinimum(1).withMaximum(1).create()).withDescription("t2").withShortName(
      "t2").create();
   
    Option helpOpt = obuilder.withLongName("help").withDescription("Print out help").withShortName("h")
        .create();
   
View Full Code Here

Examples of org.apache.commons.cli2.builder.ArgumentBuilder

  private ClusterDriver() { }
 
  public static void main(String[] args) throws IOException {
   
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
   
    Option vectorClassOpt = obuilder.withLongName("vectorClass").withRequired(false).withArgument(
      abuilder.withName("vectorClass").withMinimum(1).withMaximum(1).create()).withDescription(
      "The Vector implementation class name.  Default is RandomAccessSparseVector.class").withShortName("v")
        .create();
    Option t1Opt = obuilder.withLongName("t1").withRequired(true).withArgument(
      abuilder.withName("t1").withMinimum(1).withMaximum(1).create()).withDescription("t1").withShortName(
      "t1").create();
    Option t2Opt = obuilder.withLongName("t2").withRequired(true).withArgument(
      abuilder.withName("t2").withMinimum(1).withMaximum(1).create()).withDescription("t2").withShortName(
      "t2").create();
   
    Option pointsOpt = obuilder.withLongName("points").withRequired(true).withArgument(
      abuilder.withName("points").withMinimum(1).withMaximum(1).create()).withDescription(
      "The path containing the points").withShortName("p").create();
   
    Option canopiesOpt = obuilder.withLongName("canopies").withRequired(true).withArgument(
      abuilder.withName("canopies").withMinimum(1).withMaximum(1).create()).withDescription(
      "The location of the canopies, as a Path").withShortName("c").create();
   
    Option measureClassOpt = obuilder.withLongName("distance").withRequired(false).withArgument(
      abuilder.withName("distance").withMinimum(1).withMaximum(1).create()).withDescription(
      "The Distance Measure to use.  Default is SquaredEuclidean").withShortName("m").create();
   
    Option outputOpt = obuilder.withLongName("output").withRequired(true).withArgument(
      abuilder.withName("output").withMinimum(1).withMaximum(1).create()).withDescription(
      "The Path to put the output in").withShortName("o").create();
   
    Option helpOpt = obuilder.withLongName("help").withDescription("Print out help").withShortName("h")
        .create();
   
View Full Code Here

Examples of org.apache.commons.cli2.builder.ArgumentBuilder

  /**
   * @param args
   */
  public static void main(String[] args) throws IOException {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
   
    Option inputOpt = obuilder.withLongName("input").withRequired(true).withArgument(
      abuilder.withName("input").withMinimum(1).withMaximum(1).create()).withDescription(
      "The Path for input Vectors. Must be a SequenceFile of Writable, Vector").withShortName("i").create();
   
    Option outputOpt = obuilder.withLongName("output").withRequired(true).withArgument(
      abuilder.withName("output").withMinimum(1).withMaximum(1).create()).withDescription(
      "The Path to put the output in").withShortName("o").create();
   
    Option measureClassOpt = obuilder.withLongName("distance").withRequired(false).withArgument(
      abuilder.withName("distance").withMinimum(1).withMaximum(1).create()).withDescription(
      "The Distance Measure to use.  Default is SquaredEuclidean").withShortName("m").create();
   
    Option vectorClassOpt = obuilder.withLongName("vectorClass").withRequired(false).withArgument(
      abuilder.withName("vectorClass").withMinimum(1).withMaximum(1).create()).withDescription(
      "The Vector implementation class name.  Default is RandomAccessSparseVector.class").withShortName("v")
        .create();
    Option t1Opt = obuilder.withLongName("t1").withRequired(true).withArgument(
      abuilder.withName("t1").withMinimum(1).withMaximum(1).create()).withDescription("t1").withShortName(
      "t1").create();
    Option t2Opt = obuilder.withLongName("t2").withRequired(true).withArgument(
      abuilder.withName("t2").withMinimum(1).withMaximum(1).create()).withDescription("t2").withShortName(
      "t2").create();
   
    Option helpOpt = obuilder.withLongName("help").withDescription("Print out help").withShortName("h")
        .create();
   
View Full Code Here

Examples of org.apache.commons.cli2.builder.ArgumentBuilder

   
  }
 
  public static void main(String[] args) throws Exception {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
   
    Option parentOpt = obuilder.withLongName("input").withRequired(true).withArgument(
      abuilder.withName("input").withMinimum(1).withMaximum(1).create()).withDescription(
      "The input dir containing the documents").withShortName("i").create();
   
    Option outputDirOpt = obuilder.withLongName("output").withRequired(true).withArgument(
      abuilder.withName("output").withMinimum(1).withMaximum(1).create()).withDescription(
      "The output directory").withShortName("o").create();
   
    Option chunkSizeOpt = obuilder.withLongName("chunkSize").withArgument(
      abuilder.withName("chunkSize").withMinimum(1).withMaximum(1).create()).withDescription(
      "The chunkSize in MegaBytes. Defaults to 64").withShortName("chunk").create();
   
    Option keyPrefixOpt = obuilder.withLongName("keyPrefix").withArgument(
      abuilder.withName("keyPrefix").withMinimum(1).withMaximum(1).create()).withDescription(
      "The prefix to be prepended to the key").withShortName("prefix").create();
   
    Option charsetOpt = obuilder.withLongName("charset").withRequired(true).withArgument(
      abuilder.withName("charset").withMinimum(1).withMaximum(1).create()).withDescription(
      "The name of the character encoding of the input files").withShortName("c").create();
   
    Option helpOpt = obuilder.withLongName("help").withDescription("Print out help").withShortName("h")
        .create();
   
View Full Code Here

Examples of org.apache.commons.cli2.builder.ArgumentBuilder

 
  private Driver() { }
 
  public static void main(String[] args) throws IOException {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
   
    Option inputOpt = obuilder.withLongName("dir").withRequired(true).withArgument(
      abuilder.withName("dir").withMinimum(1).withMaximum(1).create())
        .withDescription("The Lucene directory").withShortName("d").create();
   
    Option outputOpt = obuilder.withLongName("output").withRequired(true).withArgument(
      abuilder.withName("output").withMinimum(1).withMaximum(1).create()).withDescription("The output file")
        .withShortName("o").create();
   
    Option fieldOpt = obuilder.withLongName("field").withRequired(true).withArgument(
      abuilder.withName("field").withMinimum(1).withMaximum(1).create()).withDescription(
      "The field in the index").withShortName("f").create();
   
    Option idFieldOpt = obuilder.withLongName("idField").withRequired(false).withArgument(
      abuilder.withName("idField").withMinimum(1).withMaximum(1).create()).withDescription(
      "The field in the index containing the index.  If null, then the Lucene internal doc "
          + "id is used which is prone to error if the underlying index changes").withShortName("i").create();
   
    Option dictOutOpt = obuilder.withLongName("dictOut").withRequired(true).withArgument(
      abuilder.withName("dictOut").withMinimum(1).withMaximum(1).create()).withDescription(
      "The output of the dictionary").withShortName("t").create();
   
    Option weightOpt = obuilder.withLongName("weight").withRequired(false).withArgument(
      abuilder.withName("weight").withMinimum(1).withMaximum(1).create()).withDescription(
      "The kind of weight to use. Currently TF or TFIDF").withShortName("w").create();
   
    Option delimiterOpt = obuilder.withLongName("delimiter").withRequired(false).withArgument(
      abuilder.withName("delimiter").withMinimum(1).withMaximum(1).create()).withDescription(
      "The delimiter for outputing the dictionary").withShortName("l").create();
    Option powerOpt = obuilder.withLongName("norm").withRequired(false).withArgument(
      abuilder.withName("norm").withMinimum(1).withMaximum(1).create()).withDescription(
      "The norm to use, expressed as either a double or \"INF\" if you want to use the Infinite norm.  "
          + "Must be greater or equal to 0.  The default is not to normalize").withShortName("n").create();
    Option maxOpt = obuilder.withLongName("max").withRequired(false).withArgument(
      abuilder.withName("max").withMinimum(1).withMaximum(1).create()).withDescription(
      "The maximum number of vectors to output.  If not specified, then it will loop over all docs")
        .withShortName("m").create();
   
    Option outWriterOpt = obuilder.withLongName("outputWriter").withRequired(false).withArgument(
      abuilder.withName("outputWriter").withMinimum(1).withMaximum(1).create()).withDescription(
      "The VectorWriter to use, either seq "
          + "(SequenceFileVectorWriter - default) or file (Writes to a File using JSON format)")
        .withShortName("e").create();
    Option minDFOpt = obuilder.withLongName("minDF").withRequired(false).withArgument(
      abuilder.withName("minDF").withMinimum(1).withMaximum(1).create()).withDescription(
      "The minimum document frequency.  Default is 1").withShortName("md").create();
    Option maxDFPercentOpt = obuilder.withLongName("maxDFPercent").withRequired(false).withArgument(
      abuilder.withName("maxDFPercent").withMinimum(1).withMaximum(1).create()).withDescription(
      "The max percentage of docs for the DF.  Can be used to remove really high frequency terms."
          + "  Expressed as an integer between 0 and 100. Default is 99.").withShortName("x").create();
    Option helpOpt = obuilder.withLongName("help").withDescription("Print out help").withShortName("h")
        .create();
    Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(idFieldOpt).withOption(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.