WF(WF wf, AnnotationContainer annotationContainer) { super(wf.getId()); this.annotationContainer = annotationContainer; this.sent = wf.sent; this.para = wf.para; this.page = wf.page; this.offset = wf.offset; this.length = wf.length; this.xpath = wf.xpath; this.form = wf.form; }
public String getId() { return this.word.getId(); }
Term getTermByWF(WF wf) { List<Term> terms = this.termsIndexedByWF.get(wf.getId()); if (terms == null) { return null; } return terms.get(0); }
List<Term> getTermsByWF(WF wf) { List<Term> terms = this.termsIndexedByWF.get(wf.getId()); return (terms == null) ? new ArrayList<Term>() : terms; }
List<Timex3> getTimeExsByWF(WF wf) { List<Timex3> timeExs = this.timeExsIndexedByWF.get(wf.getId()); return (timeExs == null) ? new ArrayList<Timex3>() : timeExs; }
private void addToWfTermIndex(List<WF> wfs, Term term) { for (WF wf : wfs) { String id = wf.getId(); List<Term> terms = wfId2Terms.get(id); if (terms == null) { terms = new ArrayList<Term>(); wfId2Terms.put(id, terms); } terms.add(term); } }
public String getId() { return word.getWFs().get(0).getId(); }
/** * Get all the WF ids for the terms contained in the KAFDocument. * @param kaf the KAFDocument * @return the list of all WF ids in the terms layer */ public List<String> getAllWFIdsFromTerms(KAFDocument kaf) { List<Term> terms = kaf.getTerms(); List<String> wfTermIds = new ArrayList<>(); for (int i = 0; i < terms.size(); i++) { List<WF> sentTerms = terms.get(i).getWFs(); for (WF form : sentTerms) { wfTermIds.add(form.getId()); } } return wfTermIds; }
/** * Adds a factuality to the container */ void add(Factuality factuality) { factualities.add(factuality); /* Index by terms */ if (factuality.getWFs() != null) { for (WF wf : factuality.getWFs()) { indexAnnotation(factuality, wf.getId(), factsIndexedByWF); } } }
/** Adds a timeExpression to the container */ void add(Timex3 timex3) { timeExpressions.add(timex3); /* Index by terms */ if(timex3.hasSpan()){ for (WF wf : timex3.getSpan().getTargets()) { indexAnnotation(timex3, wf.getId(), timeExsIndexedByWF); } } }
/** * Adds a linked entity to the container */ void add(LinkedEntity linkedEntity) { linkedEntities.add(linkedEntity); /* Index by terms */ if (linkedEntity.getWFs() != null) { for (WF wf : linkedEntity.getWFs().getTargets()) { indexAnnotation(linkedEntity, wf.getId(), linkedEntitiesIndexedByWF); } } }
void add(Term term, int index) { terms.add(index, term); for (WF wf : term.getWFs()) { indexAnnotation(term, wf.getId(), termsIndexedByWF); } if (!term.isComponent()) { this.indexBySent(term, term.getSent(), this.termsIndexedBySent); } }
for (int i = 0; i < sentence.size(); i++) { tokens[i] = sentence.get(i).getForm(); tokenIds[i] = sentence.get(i).getId();
List<WF> copiedTargets = new ArrayList<WF>(); for (WF wf : targets) { WF copiedWf = wfs.get(wf.getId()); if (copiedWf == null) { throw new IllegalStateException("WF not found when copying Term " + term.getId()); WF copiedHead = wfs.get(term.span.getHead().getId()); this.span = new Span<WF>(copiedTargets, copiedHead);
for (int i = 0; i < sentence.size(); i++) { tokens[i] = sentence.get(i).getForm(); tokenIds[i] = sentence.get(i).getId();
List<WF> copiedTargets = new ArrayList<WF>(); for (WF wf : targets) { WF copiedWf = wfs.get(wf.getId()); if (copiedWf == null) { throw new IllegalStateException("WF not found when copying Term " + term.getId()); WF copiedHead = wfs.get(term.span.getHead().getId()); this.span = new Span<WF>(copiedTargets, copiedHead);
for (int i = 0; i < sentence.size(); i++) { tokens[i] = sentence.get(i).getForm(); tokenIds[i] = sentence.get(i).getId();
for (int i = 0; i < sentence.size(); i++) { tokens[i] = sentence.get(i).getForm(); tokenIds[i] = sentence.get(i).getId();
WF wfCopy = new WF(wf, this.annotationContainer); this.insertWF(wfCopy); copiedWFs.put(wf.getId(), wfCopy);
for (WF target : term.getWFs()) { Element targetElem = new Element("target"); targetElem.setAttribute("id", target.getId()); if (target == span.getHead()) { targetElem.setAttribute("head", "yes");