Package org.apache.commons.cli2.builder

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


 
  private DirichletJob() {}
 
  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(false).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();
   
    Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(outputOpt)
        .withOption(modelOpt).withOption(prototypeOpt).withOption(sizeOpt).withOption(maxIterOpt).withOption(
          mOpt).withOption(topicsOpt).withOption(helpOpt).create();
View Full Code Here


 
  private FuzzyKMeansDriver() { }
 
  public static void main(String[] args) throws Exception {
    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 clustersOpt = obuilder.withLongName("clusters").withRequired(true).withArgument(
      abuilder.withName("clusters").withMinimum(1).withMaximum(1).create()).withDescription(
      "The input centroids, as Vectors.  Must be a SequenceFile of Writable, Cluster/Canopy.  "
          + "If k is also specified, then a random set of vectors will be selected"
          + " and written out to this path first").withShortName("c").create();
   
    Option kOpt = obuilder.withLongName("k").withRequired(false).withArgument(
      abuilder.withName("k").withMinimum(1).withMaximum(1).create()).withDescription(
      "The k in k-Means.  If specified, then a random selection of k Vectors will be chosen"
          + " as the Centroid and written to the clusters output path.").withShortName("k").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("dm").create();
   
    Option convergenceDeltaOpt = obuilder.withLongName("convergence").withRequired(false).withArgument(
      abuilder.withName("convergence").withMinimum(1).withMaximum(1).create()).withDescription(
      "The threshold below which the clusters are considered to be converged.  Default is 0.5")
        .withShortName("d").create();
   
    Option maxIterationsOpt = obuilder.withLongName("max").withRequired(false).withArgument(
      abuilder.withName("max").withMinimum(1).withMaximum(1).create()).withDescription(
      "The maximum number of iterations to perform.  Default is 20").withShortName("x").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 helpOpt = obuilder.withLongName("help").withDescription("Print out help").withShortName("h")
        .create();
   
    Option overwriteOutput = obuilder.withLongName("overwrite").withRequired(false).withDescription(
      "If set, overwrite the output directory").withShortName("w").create();
   
    Option clusteringOpt = obuilder.withLongName("clustering").withRequired(false).withDescription(
      "If true, run clustering only (assumes the iterations have already taken place").withShortName("l")
        .create();
   
    Option mOpt = obuilder.withLongName("m").withRequired(true).withArgument(
      abuilder.withName("m").withMinimum(1).withMaximum(1).create()).withDescription(
      "coefficient normalization factor, must be greater than 1").withShortName("m").create();
   
    Option numReduceTasksOpt = obuilder.withLongName("numReduce").withRequired(false).withArgument(
      abuilder.withName("numReduce").withMinimum(1).withMaximum(1).create()).withDescription(
      "The number of reduce tasks").withShortName("r").create();
   
    Option numMapTasksOpt = obuilder.withLongName("numMap").withRequired(false).withArgument(
      abuilder.withName("numMap").withMinimum(1).withMaximum(1).create()).withDescription(
      "The number of map tasks").withShortName("u").create();
   
    Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(clustersOpt).withOption(
      outputOpt).withOption(measureClassOpt).withOption(convergenceDeltaOpt).withOption(maxIterationsOpt)
        .withOption(kOpt).withOption(mOpt).withOption(vectorClassOpt).withOption(overwriteOutput).withOption(
View Full Code Here

  private FuzzyKMeansJob() { }
 
  public static void main(String[] args) throws IOException {
   
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();
   
    Option inputOpt = DefaultOptionCreator.inputOption().create();
    Option outputOpt = DefaultOptionCreator.outputOption().create();
    Option convergenceDeltaOpt = DefaultOptionCreator.convergenceOption().create();
    Option measureClassOpt = DefaultOptionCreator.distanceOption().create();
    Option maxIterOpt = DefaultOptionCreator.maxIterOption().create();
    Option helpOpt = DefaultOptionCreator.helpOption();
   
    Option clustersOpt = obuilder.withLongName("clusters").withRequired(true).withShortName("c")
        .withArgument(abuilder.withName("clusters").withMinimum(1).withMaximum(1).create()).withDescription(
          "The directory pathname for initial clusters.").create();
   
    Option numMapOpt = obuilder.withLongName("maxMap").withRequired(true).withShortName("p").withArgument(
      abuilder.withName("maxMap").withMinimum(1).withMaximum(1).create()).withDescription(
      "The maximum number of maptasks.").create();
   
    Option numRedOpt = obuilder.withLongName("maxRed").withRequired(true).withShortName("r").withArgument(
      abuilder.withName("maxRed").withMinimum(1).withMaximum(1).create()).withDescription(
      "The maximum number of reduce tasks.").create();
   
    Option doCanopyOpt = obuilder.withLongName("doCanopy").withRequired(true).withShortName("a")
        .withArgument(abuilder.withName("doCanopy").withMinimum(1).withMaximum(1).create()).withDescription(
          "Does canopy needed for initial clusters.").create();
   
    Option mOpt = obuilder.withLongName("fuzzify").withRequired(true).withShortName("m").withArgument(
      abuilder.withName("fuzzify").withMinimum(1).withMaximum(1).create()).withDescription(
      "Param needed to fuzzify the cluster membership values.").create();
   
    Option vectorClassOpt = obuilder.withLongName("vectorclass").withRequired(true).withShortName("e")
        .withArgument(abuilder.withName("vectorclass").withMinimum(1).withMaximum(1).create())
        .withDescription("Class name of vector implementation to use.").create();
   
    Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(clustersOpt).withOption(
      outputOpt).withOption(measureClassOpt).withOption(convergenceDeltaOpt).withOption(maxIterOpt)
        .withOption(numMapOpt).withOption(numRedOpt).withOption(doCanopyOpt).withOption(mOpt).withOption(
View Full Code Here

  private LDADriver() {}
 
  public static void main(String[] args) throws ClassNotFoundException, IOException, InterruptedException {
   
    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 Output Working Directory").withShortName("o").create();
   
    Option overwriteOutput = obuilder.withLongName("overwrite").withRequired(false).withDescription(
      "If set, overwrite the output directory").withShortName("w").create();
   
    Option topicsOpt = obuilder.withLongName("numTopics").withRequired(true).withArgument(
      abuilder.withName("numTopics").withMinimum(1).withMaximum(1).create()).withDescription(
      "The number of topics").withShortName("k").create();
   
    Option wordsOpt = obuilder.withLongName("numWords").withRequired(true).withArgument(
      abuilder.withName("numWords").withMinimum(1).withMaximum(1).create()).withDescription(
      "The total number of words in the corpus").withShortName("v").create();
   
    Option topicSmOpt = obuilder.withLongName("topicSmoothing").withRequired(false).withArgument(
      abuilder.withName("topicSmoothing").withDefault(-1.0).withMinimum(0).withMaximum(1).create())
        .withDescription("Topic smoothing parameter. Default is 50/numTopics.").withShortName("a").create();
   
    Option maxIterOpt = obuilder.withLongName("maxIter").withRequired(false).withArgument(
      abuilder.withName("maxIter").withDefault(-1).withMinimum(0).withMaximum(1).create()).withDescription(
      "Max iterations to run (or until convergence). -1 (default) waits until convergence.").create();
   
    Option numReducOpt = obuilder.withLongName("numReducers").withRequired(false).withArgument(
      abuilder.withName("numReducers").withDefault(10).withMinimum(0).withMaximum(1).create())
        .withDescription("Max iterations to run (or until convergence). Default 10").create();
   
    Option helpOpt = obuilder.withLongName("help").withDescription("Print out help").withShortName("h")
        .create();
   
View Full Code Here

    HiveConf.setVar(conf, ConfVars.SEMANTIC_ANALYZER_HOOK, HowlSemanticAnalyzer.class.getName());

    SessionState.start(ss);

    DefaultOptionBuilder builder = new DefaultOptionBuilder("-", "--", false);
    ArgumentBuilder argBuilder = new ArgumentBuilder();
    // -e
    Option execOption = createOptionWithArg(builder, "exec", "e", "execute the following command",argBuilder.withMinimum(1).withMaximum(1).create());
    // -f
    Option fileOption = createOptionWithArg(builder, "file", "f","execute commands from the following file", argBuilder.withMinimum(1).withMaximum(1).create());
    // -g
    Option grpOption = createOptionWithArg(builder, "group", "g","group for the db/table specified in CREATE statement", argBuilder.withMinimum(1).withMaximum(1).create());
    // -p
    Option permOption = createOptionWithArg(builder, "perms", "p","permissions for the db/table specified in CREATE statement",
        argBuilder.withMinimum(1).withMaximum(1).create());

    builder.reset();
    Option isHelpOption =  builder.withShortName("h").withLongName("help").withDescription("help").create();
    new PropertyOption();
    Group allOptions = new GroupBuilder().withOption(isHelpOption).withOption(execOption).withOption(fileOption).withOption(grpOption).withOption(permOption).create();
View Full Code Here

  }

  public OptionsProcessor() {
    DefaultOptionBuilder builder = new DefaultOptionBuilder("-", "-", false);

    ArgumentBuilder argBuilder = new ArgumentBuilder();

    // -e
    execOption = createOptionWithArg(builder, "exec", "e", "execute the following command",
        argBuilder.withMinimum(1).withMaximum(1).create());

    // -f
    fileOption = createOptionWithArg(builder, "file", "f",
        "execute commands from the following file", argBuilder.withMinimum(1).withMaximum(1)
            .create());

    // -S
    isSilentOption = createBoolOption(builder, "silent", "S", "silent mode");
View Full Code Here

  /**
   * Run TopK FPGrowth given the input file,
   */
  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(
      "The Directory on HDFS containing the transaction files").withShortName("i").create();
   
    Option outputOpt = DefaultOptionCreator.outputOption().create();
   
    Option helpOpt = DefaultOptionCreator.helpOption();
   
    // minSupport(3), maxHeapSize(50), numGroups(1000)
    Option minSupportOpt = obuilder.withLongName("minSupport").withArgument(
      abuilder.withName("minSupport").withMinimum(1).withMaximum(1).create()).withDescription(
      "(Optional) Minimum Support. Default Value: 3").withShortName("s").create();
   
    Option maxHeapSizeOpt = obuilder.withLongName("maxHeapSize").withArgument(
      abuilder.withName("maxHeapSize").withMinimum(1).withMaximum(1).create()).withDescription(
      "(Optional) Maximum Heap Size k, to denote the requirement to mine top K items. Default value: 50")
        .withShortName("k").create();
   
    Option numGroupsOpt = obuilder.withLongName("numGroups").withArgument(
      abuilder.withName("numGroups").withMinimum(1).withMaximum(1).create()).withDescription(
      "(Optional) Number of groups the features should be divided in the map-reduce version."
          + " Doesn't work in sequential version Default Value:1000").withShortName("g").create();
   
    Option recordSplitterOpt = obuilder.withLongName("splitterPattern").withArgument(
      abuilder.withName("splitterPattern").withMinimum(1).withMaximum(1).create()).withDescription(
      "Regular Expression pattern used to split given string transaction into itemsets."
          + " Default value splits comma separated itemsets.  Default Value:"
          + " \"[ ,\\t]*[,|\\t][ ,\\t]*\" ").withShortName("regex").create();
   
    Option treeCacheOpt = obuilder.withLongName("numTreeCacheEntries").withArgument(
      abuilder.withName("numTreeCacheEntries").withMinimum(1).withMaximum(1).create()).withDescription(
      "(Optional) Number of entries in the tree cache to prevent duplicate tree building. "
          + "(Warning) a first level conditional FP-Tree might consume a lot of memory, "
          + "so keep this value small, but big enough to prevent duplicate tree building. "
          + "Default Value:5 Recommended Values: [5-10]").withShortName("tc").create();
   
    Option methodOpt = obuilder.withLongName("method").withRequired(true).withArgument(
      abuilder.withName("method").withMinimum(1).withMaximum(1).create()).withDescription(
      "Method of processing: sequential|mapreduce").withShortName("method").create();
    Option encodingOpt = obuilder.withLongName("encoding").withArgument(
      abuilder.withName("encoding").withMinimum(1).withMaximum(1).create()).withDescription(
      "(Optional) The file encoding.  Default value: UTF-8").withShortName("e").create();
   
    Group group = gbuilder.withName("Options").withOption(minSupportOpt).withOption(inputDirOpt).withOption(
      outputOpt).withOption(maxHeapSizeOpt).withOption(numGroupsOpt).withOption(methodOpt).withOption(
      encodingOpt).withOption(helpOpt).withOption(treeCacheOpt).withOption(recordSplitterOpt).create();
View Full Code Here

    if (shortName != null) {
      optBuilder.withShortName(shortName);
    }

    if (hasArg) {
      ArgumentBuilder argBuilder = new ArgumentBuilder().withName(name).withMinimum(1).withMaximum(1);

      if (defaultValue != null) {
        argBuilder = argBuilder.withDefault(defaultValue);
      }

      optBuilder.withArgument(argBuilder.create());
    }

    return optBuilder.create();
  }
View Full Code Here

  public static DefaultOptionBuilder debugOutputOption() {
    return new DefaultOptionBuilder()
        .withLongName(DEBUG_OUTPUT)
        .withShortName("debug")
        .withArgument(
            new ArgumentBuilder().withName(DEBUG_OUTPUT).withDefault("false")
                .withMinimum(1).withMaximum(1).create())
        .withDescription("Cluster the whole vectors for debugging");
  }
View Full Code Here

    return new DefaultOptionBuilder()
        .withLongName(NUM_REDUCERS)
        .withRequired(false)
        .withShortName("r")
        .withArgument(
            new ArgumentBuilder().withName(NUM_REDUCERS).withDefault("2")
                .withMinimum(1).withMaximum(1).create())
        .withDescription("The number of reduce tasks. Defaults to 2");
  }
View Full Code Here

TOP

Related Classes of org.apache.commons.cli2.builder.ArgumentBuilder

Copyright © 2018 www.massapicom. 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.