public void testTesting_MultiTH_AND_Output(CommonConfig config) { MaxEntClassificationEDA meceda = new MaxEntClassificationEDA(); BufferedWriter output = null; try { meceda.initialize(config); // check the test data directory meceda.initializeData(config, false); output = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( config.getConfigurationFileName().replace("configuration-file", "results") + "_Result.txt"), "UTF-8")); logger.info("build CASes for input sentence pairs:"); int correct = 0; int sum = 0; for (File file : (new File(meceda.getTestDIR())).listFiles()) { // ignore all the non-xmi files if (!file.getName().endsWith(".xmi")) { continue; } JCas cas = PlatformCASProber.probeXmi(file, null); ClassificationTEDecision decision = meceda.process(cas); output.write(decision.getPairID()); output.write("\t"); output.write(meceda.getGoldLabel(cas).toUpperCase()); output.write("\t"); output.write(decision.getDecision().toString().toUpperCase()); output.write("\t"); output.write(String.valueOf(decision.getConfidence())); output.newLine(); logger.info("Pair " + decision.getPairID() + " is done."); if (meceda.getGoldLabel(cas).equalsIgnoreCase(decision.getDecision().toString())) { correct++; } sum++; } output.close(); logger.info("The correctly predicted pairs are " + correct + " / " + sum); meceda.shutdown(); logger.info("EDA shuts down."); } catch (Exception e) { logger.info(e.getMessage()); } }
public void testTesting_MultiTH(CommonConfig config) { MaxEntClassificationEDA meceda = new MaxEntClassificationEDA(); try { meceda.initialize(config); // check the test data directory meceda.initializeData(config, false); int correct = 0; int sum = 0; logger.info("build CASes for input sentence pairs:"); for (File file : (new File(meceda.getTestDIR())).listFiles()) { // ignore all the non-xmi files if (!file.getName().endsWith(".xmi")) { continue; } JCas cas = PlatformCASProber.probeXmi(file, null); ClassificationTEDecision decision = meceda.process(cas); logger.info(decision.getPairID()); logger.info(meceda.getGoldLabel(cas)); logger.info(decision.getDecision().toString()); logger.info(String.valueOf(decision.getConfidence())); if (meceda.getGoldLabel(cas).equalsIgnoreCase(decision.getDecision().toString())) { correct++; } sum++; } logger.info("The correctly predicted pairs are " + correct + " / " + sum); meceda.shutdown(); logger.info("EDA shuts down."); } catch (Exception e) { logger.info(e.getMessage()); } }