/** * Creates a factualitylayer object and add it to the document * * @param term the Term of the coreference. * @return a new factuality. */ public Factuality newFactuality(Term term) { Factuality factuality = new Factuality(term); annotationContainer.add(factuality); return factuality; }
private void processFactuality(final Factuality factuality) throws RDFHandlerException { // TODO: factuality should be better handled // Retrieve term and corresponding annotation final Term term = factuality.getWord(); final Annotation ann = this.annotations.get(term.getId()); // Abort if the annotation is missing or does not refer to a predicate if (ann == null || ann.predicateURI == null) { return; } // Emit a mention for the predicate extent final URI mentionURI = emitMention(ann.extent); // Emit a triple associating the factuality value to the predicate final String value = factuality.getMaxPart().getPrediction(); emitFact(ann.predicateURI, KS.FACTUALITY, value, mentionURI, null); }
public void addFactualityPart(String prediction, double confidence) { this.addFactualityPart(new FactualityPart(prediction, confidence)); }
try { Element fact = new Element("factvalue"); fact.setAttribute("id", f.getId()); fact.setAttribute("prediction", f.getMaxPart().getPrediction()); fact.setAttribute("confidence", Double.toString(f.getMaxPart().getConfidence())); for (Factuality.FactualityPart p : f.getFactualityParts()) { Element factPartial = new Element("factuality"); factPartial.setAttribute("prediction", p.getPrediction());
for (Factuality f : factualities) { Element factElem = new Element("factuality"); factElem.setAttribute("id", f.getId()); Span<Term> span = f.getSpan(); Comment spanComment = new Comment(StringEscapeUtils.escapeXml11(f.getSpanStr(span))); factElem.addContent(spanComment); Element spanElem = new Element("span"); for (Factuality.FactVal factVal : f.getFactVals()) { factElem.addContent(factValToDOM(factVal));
if (this.sentenceIDs[factuality.getWord().getSent()]) { try { processFactuality(factuality);
List<Element> factValElems = factualityElem.getChildren("factVal"); for (Element factValElem : factValElems) { newFactuality.addFactVal(DOMToFactVal(factValElem, kaf));
public Factuality newFactuality(Span<Term> span) { String newId = idManager.getNextId(AnnotationType.FACTUALITY); Factuality newFactuality= new Factuality(newId, span); annotationContainer.add(newFactuality, Layer.FACTUALITIES, AnnotationType.FACTUALITY); return newFactuality; }
String prediction = getAttribute("prediction", partElem); double confidence = Double.parseDouble(getAttribute("confidence", partElem)); factuality.addFactualityPart(prediction, confidence);
public Factuality newFactuality(String id, Span<Term> span) { idManager.updateCounter(AnnotationType.FACTUALITY, id); Factuality newFactuality= new Factuality(id, span); annotationContainer.add(newFactuality, Layer.FACTUALITIES, AnnotationType.FACTUALITY); return newFactuality; }