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 input directory")
.withShortName("i").create();
Option modelOpt = obuilder.withLongName("model").withRequired(true).withArgument(
abuilder.withName("index").withMinimum(1).withMaximum(1).create()).withDescription(
"The directory containing the index model").withShortName("m").create();
Option categoryFieldOpt = obuilder.withLongName("categoryField").withRequired(true).withArgument(
abuilder.withName("index").withMinimum(1).withMaximum(1).create()).withDescription(
"Name of the field containing category information").withShortName("catf").create();
Option contentFieldOpt = obuilder.withLongName("contentField").withRequired(true).withArgument(
abuilder.withName("index").withMinimum(1).withMaximum(1).create()).withDescription(
"Name of the field containing content information").withShortName("contf").create();
Option maxResultsOpt = obuilder.withLongName("maxResults").withRequired(false).withArgument(
abuilder.withName("gramSize").withMinimum(1).withMaximum(1).create()).withDescription(
"Number of results to retrive, default: 10 ").withShortName("r").create();
Option gramSizeOpt = obuilder.withLongName("gramSize").withRequired(false).withArgument(
abuilder.withName("gramSize").withMinimum(1).withMaximum(1).create()).withDescription(
"Size of the n-gram. Default Value: 1 ").withShortName("ng").create();
Option typeOpt = obuilder.withLongName("classifierType").withRequired(false).withArgument(
abuilder.withName("classifierType").withMinimum(1).withMaximum(1).create()).withDescription(
"Type of classifier: knn|tfidf. Default: bayes").withShortName("type").create();
Group group = gbuilder.withName("Options").withOption(gramSizeOpt).withOption(helpOpt).withOption(
inputDirOpt).withOption(modelOpt).withOption(typeOpt).withOption(contentFieldOpt)