logger.debug(fv.toString() + ", " + l.toString()); labeledData.add(ins);
public static void makeSinglePairXML(TEDecision decision, JCas aJCas, String xmlResultsFile, String lang) { Logger logger = Logger.getLogger("eu.excitementproject.eop.util.runner.OutputUtils:makeSinglePairXML"); try { OutputStream out = Files.newOutputStream(Paths.get(xmlResultsFile)); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out,"UTF-8")); writer.write("<entailment-corpus lang=\"" + lang + "\">\n"); writer.write(" <pair id=\"1\" entailment=\"" + decision.getDecision().name() + "\" benchmark=\"N/A\" confidence=\"" + decision.getConfidence() + "\" task=\"EOP test\">\n"); writer.write(" <t>" + aJCas.getView("TextView").getDocumentText() + "</t>\n"); writer.write(" <h>" + aJCas.getView("HypothesisView").getDocumentText() + "</h>\n"); writer.write(" </pair>\n"); writer.write("</entailment-corpus>\n"); writer.close(); out.close(); logger.info("Results file: " + xmlResultsFile); } catch (IOException | CASException e) { logger.error("Could not write to output file " + xmlResultsFile); e.printStackTrace(); } }
DecisionLabel decisionLabel = DecisionLabel.getLabelFor(annotationClass);
DecisionLabel goldAnswer = null; try { goldAnswer = DecisionLabel.getLabelFor(pair.getGoldAnswer()); } catch (EDAException e) { e.printStackTrace(); try { decision = meda.process(jcas); if (goldAnswer.is(DecisionLabel.NonEntailment)){ meda.getResults().get(pairID)[0]=-1; else if (goldAnswer.is(DecisionLabel.Entailment)){ meda.getResults().get(pairID)[0]=1; e.printStackTrace(); if (decision.getDecision().equals(goldAnswer)){ correct += 1;
return null; labelEnum = DecisionLabel.getLabelFor(labelString);
TEDecision teDecision = eda.process(cas); writer.write(OutputUtils.getPairID(cas) + "\t" + OutputUtils.getGoldLabel(cas) + "\t" + teDecision.getDecision().toString() + "\t" + teDecision.getConfidence() + "\n");
return null; labelEnum = DecisionLabel.getLabelFor(labelString);
labelEnum = DecisionLabel.getLabelFor(labelString);
logger.debug(fv.toString() + ", " + l.toString()); labeledData.add(ins);
String goldString = pairAnno.getGoldAnswer(); if (goldString != null) { DecisionLabel goldDecision = DecisionLabel.getLabelFor(goldString); gold = DecisionTypeMap.toRTEClassificationType(goldDecision);
TEDecision teDecision1 = eda.process(cas); list[i] = getPairID(cas) + "\t" + getGoldLabel(cas) + "\t" + teDecision1.getDecision().toString() + "\t" + teDecision1.getConfidence(); i++;
public String generateHTML(TEDecisionWithAlignment decision) throws VisualizerGenerationException { init(); JCas jCas = decision.getJCasWithAlignment(); Vector<FeatureValue> featureValues = decision.getFeatureVector(); DecisionLabel label = decision.getDecision(); Double confidence = decision.getConfidence(); try { return generateHTML(jCas, label.toString(), confidence.toString(), featureValues); } catch (ValueException e) { throw new VisualizerGenerationException(e); } }
/** * @param cas * the <code>JCas</code> object * @return return the instance of the input, represented in * <code>Event</code> */ protected final Event casToEvent(JCas cas) throws ConfigurationException { String goldAnswer = getGoldLabel(cas); if (null == goldAnswer) { goldAnswer = DecisionLabel.Abstain.toString(); } try { String[] contexts = constructContext(cas); float[] values = RealValueFileEventStream.parseContexts(contexts); return new Event(goldAnswer, contexts, values); } catch (ScoringComponentException e) { throw new ConfigurationException(e.getMessage()); } }
if (label.toUpperCase().equals(DecisionLabel.Entailment.toString().toUpperCase())) dLabel = DecisionLabel.Entailment; else
if (goldAnswer != null) part1 += "(gold answer: " + goldAnswer.toString() + ")";
if (label.toUpperCase().equals(DecisionLabel.Entailment.toString().toUpperCase())) dLabel = DecisionLabel.Entailment; else
@Override public ClassificationTEDecision process(JCas aCas) throws EDAException, ComponentException { String pairId = getPairID(aCas); String goldAnswer = getGoldLabel(aCas); if (null == goldAnswer) { goldAnswer = DecisionLabel.Abstain.toString(); } // a quick answer "yes" for identical T-H pair as input if (isIdenticalPair(aCas)) { return new ClassificationTEDecision(DecisionLabel.Entailment, 1d, pairId); } try { writeArffHeaders(false); } catch (ConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } String feats = scoreData(aCas); if (null == feats) return new ClassificationTEDecision(DecisionLabel.Abstain, pairId); feats += goldAnswer; // class label writeDatatoArff(feats, wekaArffFile + String.valueOf(0) + ".arff"); ClassificationTEDecision pred = classifyData(pairId); return pred; }