Package joshua.util

Examples of joshua.util.CommandLineParser$Option


  public static void main(String[] args) throws IOException, IllegalAccessException, InstantiationException {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
    GroupBuilder gbuilder = new GroupBuilder();

    Option seqOpt = obuilder.withLongName("seqFileDir").withRequired(false).withArgument(
      abuilder.withName("seqFileDir").withMinimum(1).withMaximum(1).create()).withDescription(
      "The directory containing Sequence Files for the Clusters").withShortName("s").create();
    Option outputOpt = obuilder.withLongName("output").withRequired(false).withArgument(
      abuilder.withName("output").withMinimum(1).withMaximum(1).create()).withDescription(
      "The output file.  If not specified, dumps to the console").withShortName("o").create();
    Option substringOpt = obuilder.withLongName("substring").withRequired(false).withArgument(
      abuilder.withName("substring").withMinimum(1).withMaximum(1).create()).withDescription(
      "The number of chars of the asFormatString() to print").withShortName("b").create();
    Option numWordsOpt = obuilder.withLongName("numWords").withRequired(false).withArgument(
      abuilder.withName("numWords").withMinimum(1).withMaximum(1).create()).withDescription(
      "The number of top terms to print").withShortName("n").create();
    Option centroidJSonOpt = obuilder.withLongName("json").withRequired(false).withDescription(
      "Output the centroid as JSON.  Otherwise it substitues in the terms for vector cell entries")
        .withShortName("j").create();
    Option pointsOpt = obuilder.withLongName("pointsDir").withRequired(false).withArgument(
      abuilder.withName("pointsDir").withMinimum(1).withMaximum(1).create()).withDescription(
      "The directory containing points sequence files mapping input vectors to their cluster.  "
          + "If specified, then the program will output the points associated with a cluster").withShortName(
      "p").create();
    Option dictOpt = obuilder.withLongName("dictionary").withRequired(false).withArgument(
      abuilder.withName("dictionary").withMinimum(1).withMaximum(1).create()).withDescription(
      "The dictionary file. ").withShortName("d").create();
    Option dictTypeOpt = obuilder.withLongName("dictionaryType").withRequired(false).withArgument(
      abuilder.withName("dictionaryType").withMinimum(1).withMaximum(1).create()).withDescription(
      "The dictionary file type (text|sequencefile)").withShortName("dt").create();
    Option helpOpt = obuilder.withLongName("help").withDescription("Print out help").withShortName("h")
        .create();

    Group group = gbuilder.withName("Options").withOption(helpOpt).withOption(seqOpt).withOption(outputOpt)
        .withOption(substringOpt).withOption(pointsOpt).withOption(centroidJSonOpt).withOption(dictOpt)
        .withOption(dictTypeOpt).withOption(numWordsOpt).create();
View Full Code Here


public final class RecommenderJob extends AbstractJob {
 
  @Override
  public int run(String[] args) throws IOException {
   
    Option recommendClassOpt = AbstractJob.buildOption("recommenderClassName", "r",
      "Name of recommender class to instantiate");
    Option numReccomendationsOpt = AbstractJob.buildOption("numRecommendations", "n",
      "Number of recommendations per user", "10");
    Option usersFileOpt = AbstractJob.buildOption("usersFile", "n", "Number of recommendations per user",
      null);
   
    Map<String,String> parsedArgs = AbstractJob.parseArguments(args, recommendClassOpt,
      numReccomendationsOpt, usersFileOpt);
    if (parsedArgs == null) {
View Full Code Here

  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(
      "Path to an LDA output (a state)").withShortName("i").create();
   
    Option dictOpt = obuilder.withLongName("dict").withRequired(true).withArgument(
      abuilder.withName("dict").withMinimum(1).withMaximum(1).create()).withDescription(
      "Dictionary to read in, in the same format as one created by "
          + "org.apache.mahout.utils.vectors.lucene.Driver").withShortName("d").create();
   
    Option outOpt = obuilder.withLongName("output").withRequired(false).withArgument(
      abuilder.withName("output").withMinimum(1).withMaximum(1).create()).withDescription(
      "Output directory to write top words").withShortName("o").create();
   
    Option wordOpt = obuilder.withLongName("words").withRequired(false).withArgument(
      abuilder.withName("words").withMinimum(0).withMaximum(1).withDefault("20").create()).withDescription(
      "Number of words to print").withShortName("w").create();
    Option dictTypeOpt = obuilder.withLongName("dictionaryType").withRequired(false).withArgument(
      abuilder.withName("dictionaryType").withMinimum(1).withMaximum(1).create()).withDescription(
      "The dictionary file type (text|sequencefile)").withShortName("dt").create();
    Option helpOpt = obuilder.withLongName("help").withDescription("Print out help").withShortName("h")
        .create();
   
    Group group = gbuilder.withName("Options").withOption(dictOpt).withOption(outOpt).withOption(wordOpt)
        .withOption(inputOpt).withOption(dictTypeOpt).create();
    try {
View Full Code Here

  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(
View Full Code Here

 
  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)
View Full Code Here

   
    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)
View Full Code Here

   
    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();
   
    Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(outputOpt).withOption(
      topicsOpt).withOption(wordsOpt).withOption(topicSmOpt).withOption(maxIterOpt).withOption(numReducOpt)
        .withOption(overwriteOutput).withOption(helpOpt).create();
View Full Code Here

    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();

    Parser parser = new Parser();
    parser.setGroup(allOptions);
View Full Code Here

          }
          fileValidator.validate(values);
        }     
      };

    Option input   = createOption("input",
                                  "DFS input file(s) for the Map step",
                                  "path",
                                  Integer.MAX_VALUE,
                                  true)
   
    Option output  = createOption("output",
                                  "DFS output directory for the Reduce step",
                                  "path", 1, true);
    Option mapper  = createOption("mapper",
                                  "The streaming command to run", "cmd", 1, false);
    Option combiner = createOption("combiner",
                                   "The streaming command to run", "cmd", 1, false);
    // reducer could be NONE
    Option reducer = createOption("reducer",
                                  "The streaming command to run", "cmd", 1, false);
    Option file = createOption("file",
                               "File/dir to be shipped in the Job jar file",
                               "file", Integer.MAX_VALUE, false, execValidator);
    Option dfs = createOption("dfs",
                              "Optional. Override DFS configuration", "<h:p>|local", 1, false);
    Option jt = createOption("jt",
                             "Optional. Override JobTracker configuration", "<h:p>|local", 1, false);
    Option additionalconfspec = createOption("additionalconfspec",
                                             "Optional.", "spec", 1, false);
    Option inputformat = createOption("inputformat",
                                      "Optional.", "spec", 1, false);
    Option outputformat = createOption("outputformat",
                                       "Optional.", "spec", 1, false);
    Option partitioner = createOption("partitioner",
                                      "Optional.", "spec", 1, false);
    Option numReduceTasks = createOption("numReduceTasks",
        "Optional.", "spec",1, false );
    Option inputreader = createOption("inputreader",
                                      "Optional.", "spec", 1, false);
    Option mapDebug = createOption("mapdebug",
                                   "Optional.", "spec", 1, false);
    Option reduceDebug = createOption("reducedebug",
                                      "Optional", "spec",1, false);
    Option cacheFile = createOption("cacheFile",
                                    "File name URI", "fileNameURI", Integer.MAX_VALUE, false);
    Option cacheArchive = createOption("cacheArchive",
                                       "File name URI", "fileNameURI", Integer.MAX_VALUE, false);
   
    // boolean properties
   
    Option verbose = createBoolOption("verbose", "print verbose output");
    Option info = createBoolOption("info", "print verbose output");
    Option help = createBoolOption("help", "print this help message");
    Option debug = createBoolOption("debug", "print debug output");
    Option inputtagged = createBoolOption("inputtagged", "inputtagged");
   
    allOptions = new GroupBuilder().
      withOption(input).
      withOption(output).
      withOption(mapper).
View Full Code Here

  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(
View Full Code Here

TOP

Related Classes of joshua.util.CommandLineParser$Option

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.