jsap.registerParameter(opt3);
jsap.registerParameter(opt4);
// check whether the command line was valid, and if it wasn't,
// display usage information and exit.
JSAPResult config = jsap.parse(args);
if (!config.success()) {
for (java.util.Iterator errs = config.getErrorMessageIterator(); errs.hasNext();) {
System.err.println("Error: " + errs.next());
}
displayHelp(config, jsap);
return;
}
if (config.getBoolean("help")){
displayHelp(config, jsap);
return;
}
String inDirName = config.getString("inDir");
String outDirName = config.getString("outDir");
// Make sure the code, bugs, and lda files exist
if (! (new File((inDirName)).exists())){
System.err.println("Error: " + inDirName + " does not exist.");
return;
}
// If the output directory already exists, remove it (or else Lucene will complain)
File indexDir = new File(outDirName + "/index");
if (indexDir.exists()){
FileUtils.deleteDirectory(indexDir);
}
// Read the fileCodes, if there is one
if (config.getString("fileCodes") != null){
// TODO
}
// TODO: Run LDA, and build an LDAHelper object
LDAHelper ldaHelper = new LDAHelper();
ldaHelper.runLDA(config.getInt("numK"), inDirName);
// Build the index, with the options specified.
SimpleIndexer.indexDirectory(inDirName, outDirName, config.getString("fileCodes"), ldaHelper);
}