public boolean parseArgs(String[] args) throws Exception {
DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();
Option helpOpt = DefaultOptionCreator.helpOption();
Option inputDirOpt = obuilder.withLongName("inputDir").withRequired(true).withArgument(
abuilder.withName("inputDir").withMinimum(1).withMaximum(1).create()).withDescription(
"The input directory").withShortName("i").create();
Option trainingOutputDirOpt = obuilder.withLongName("trainingOutputDir").withRequired(true).withArgument(
abuilder.withName("outputDir").withMinimum(1).withMaximum(1).create()).withDescription(
"The training data output directory").withShortName("tr").create();
Option testOutputDirOpt = obuilder.withLongName("testOutputDir").withRequired(true).withArgument(
abuilder.withName("outputDir").withMinimum(1).withMaximum(1).create()).withDescription(
"The test data output directory").withShortName("te").create();
Option testSplitSizeOpt = obuilder.withLongName("testSplitSize").withRequired(false).withArgument(
abuilder.withName("splitSize").withMinimum(1).withMaximum(1).create()).withDescription(
"The number of documents held back as test data for each category").withShortName("ss").create();
Option testSplitPctOpt = obuilder.withLongName("testSplitPct").withRequired(false).withArgument(
abuilder.withName("splitPct").withMinimum(1).withMaximum(1).create()).withDescription(
"The percentage of documents held back as test data for each category").withShortName("sp").create();
Option splitLocationOpt = obuilder.withLongName("splitLocation").withRequired(false).withArgument(
abuilder.withName("splitLoc").withMinimum(1).withMaximum(1).create()).withDescription(
"Location for start of test data expressed as a percentage of the input file size (0=start, 50=middle, 100=end")
.withShortName("sl").create();
Option randomSelectionSizeOpt = obuilder.withLongName("randomSelectionSize").withRequired(false).withArgument(
abuilder.withName("randomSize").withMinimum(1).withMaximum(1).create()).withDescription(
"The number of itemr to be randomly selected as test data ").withShortName("rs").create();
Option randomSelectionPctOpt = obuilder.withLongName("randomSelectionPct").withRequired(false).withArgument(
abuilder.withName("randomPct").withMinimum(1).withMaximum(1).create()).withDescription(
"Percentage of items to be randomly selected as test data ").withShortName("rp").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();
Group group = gbuilder.withName("Options").withOption(inputDirOpt).withOption(trainingOutputDirOpt)
.withOption(testOutputDirOpt).withOption(testSplitSizeOpt).withOption(testSplitPctOpt)