try {
Parser parser = new Parser();
parser.setGroup(group);
CommandLine cmdLine = parser.parse(args);
if (cmdLine.hasOption(helpOpt)) {
CommandLineUtil.printHelp(group);
return false;
}
inputDirectory = new Path((String) cmdLine.getValue(inputDirOpt));
trainingOutputDirectory = new Path((String) cmdLine.getValue(trainingOutputDirOpt));
testOutputDirectory = new Path((String) cmdLine.getValue(testOutputDirOpt));
charset = Charset.forName((String) cmdLine.getValue(charsetOpt));
if (cmdLine.hasOption(testSplitSizeOpt) && cmdLine.hasOption(testSplitPctOpt)) {
throw new OptionException(testSplitSizeOpt, "must have either split size or split percentage option, not BOTH");
} else if (!cmdLine.hasOption(testSplitSizeOpt) && !cmdLine.hasOption(testSplitPctOpt)) {
throw new OptionException(testSplitSizeOpt, "must have either split size or split percentage option");
}
if (cmdLine.hasOption(testSplitSizeOpt)) {
setTestSplitSize(Integer.parseInt((String) cmdLine.getValue(testSplitSizeOpt)));
}
if (cmdLine.hasOption(testSplitPctOpt)) {
setTestSplitPct(Integer.parseInt((String) cmdLine.getValue(testSplitPctOpt)));
}
if (cmdLine.hasOption(splitLocationOpt)) {
setSplitLocation(Integer.parseInt((String) cmdLine.getValue(splitLocationOpt)));
}
if (cmdLine.hasOption(randomSelectionSizeOpt)) {
setTestRandomSelectionSize(Integer.parseInt((String) cmdLine.getValue(randomSelectionSizeOpt)));
}
if (cmdLine.hasOption(randomSelectionPctOpt)) {
setTestRandomSelectionPct(Integer.parseInt((String) cmdLine.getValue(randomSelectionPctOpt)));
}
fs.mkdirs(trainingOutputDirectory);
fs.mkdirs(testOutputDirectory);