public static void main(String[] args) throws Exception {
DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();
Option seqOpt = obuilder.withLongName("seqFile").withRequired(false).withArgument(
abuilder.withName("seqFile").withMinimum(1).withMaximum(1).create()).withDescription(
"The Sequence File containing the Vectors").withShortName("s").create();
Option vectorAsKeyOpt = obuilder.withLongName("useKey").withRequired(false).withDescription(
"If the Key is a vector, then dump that instead").withShortName("u").create();
Option printKeyOpt = obuilder.withLongName("printKey").withRequired(false).withDescription(
"Print out the key as well, delimited by a tab (or the value if useKey is true)").withShortName("p")
.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 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 csvOpt = obuilder.withLongName("csv").withRequired(false).withDescription(
"Output the Vector as CSV. Otherwise it substitutes in the terms for vector cell entries")
.withShortName("c").create();
Option namesAsCommentsOpt = obuilder.withLongName("namesAsComments").withRequired(false).withDescription(
"If using CSV output, optionally add a comment line for each NamedVector (if the vector is one) printing out the name")
.withShortName("n").create();
Option sortVectorsOpt = obuilder.withLongName("sortVectors").withRequired(false).withDescription(
"Sort output key/value pairs of the vector entries in abs magnitude descending order")
.withShortName("sort").create();
Option sizeOpt = obuilder.withLongName("sizeOnly").withRequired(false).
withDescription("Dump only the size of the vector").withShortName("sz").create();
Option numItemsOpt = obuilder.withLongName("numItems").withRequired(false).withArgument(
abuilder.withName("n").withMinimum(1).withMaximum(1).create()).
withDescription("Output at most <n> vecors").withShortName("n").create();
Option numIndexesPerVectorOpt = obuilder.withLongName("vectorSize").withShortName("vs")
.withRequired(false).withArgument(abuilder.withName("vs").withMinimum(1)
.withMaximum(1).create())
.withDescription("Truncate vectors to <vs> length when dumping (most useful when in"
+ " conjunction with -sort").create();
Option filtersOpt = obuilder.withLongName("filter").withRequired(false).withArgument(
abuilder.withName("filter").withMinimum(1).withMaximum(100).create()).
withDescription("Only dump out those vectors whose name matches the filter." +
" Multiple items may be specified by repeating the argument.").withShortName("fi").create();
Option helpOpt = obuilder.withLongName("help").withDescription("Print out help").withShortName("h")
.create();
Group group = gbuilder.withName("Options").withOption(seqOpt).withOption(outputOpt)
.withOption(dictTypeOpt).withOption(dictOpt).withOption(csvOpt)
.withOption(vectorAsKeyOpt).withOption(printKeyOpt).withOption(sortVectorsOpt)