public static void main(String[] args) {
try {
final CommandLine cmd = CommandLine
.parser()
.withName("VerbNetStatisticsExtractor")
.withHeader("Extracts statistics from OntoNotes on frequency of VerbNet/FrameNet")
.withOption("n", "ontonotes", "OntoNotes folder", "FOLDER", CommandLine.Type.DIRECTORY_EXISTING, true, false, true)
.withOption("o", "output", "output file", "FILE", CommandLine.Type.FILE, true, false, true)
.withLogger(LoggerFactory.getLogger("eu.fbk.nafview")).parse(args);
final File dir = cmd.getOptionValue("n", File.class);
final File output = cmd.getOptionValue("o", File.class);
VerbNetStatisticsExtractor statisticsExtractor = new VerbNetStatisticsExtractor();
statisticsExtractor.loadDir(dir.getAbsolutePath());
try {
statisticsExtractor.loadFrequencies();
} catch (Exception e) {
e.printStackTrace();
}
BufferedWriter writer = new BufferedWriter(new FileWriter(output));
for (String key : statisticsExtractor.getVnTotals().keySet()) {
writer.append("VN").append("\t").append(key).append("\t").append(statisticsExtractor.getVnTotals().get(key).toString()).append("\n");
}
for (String key : statisticsExtractor.getFnTotals().keySet()) {
writer.append("FN").append("\t").append(key).append("\t").append(statisticsExtractor.getFnTotals().get(key).toString()).append("\n");
}
writer.close();
} catch (final Throwable ex) {
CommandLine.fail(ex);
}
}