// maxSpanID += sa.getMaxID();
}
private void createCorefPairs(LinkedList<Annotation> lm, int p, JCas jcas) {
NEMarkable m = (NEMarkable) lm.get(p); // Current markable under consideration
MarkablePairSet pairList = new MarkablePairSet(jcas);
pairList.setBegin(m.getBegin());
pairList.setEnd(m.getEnd());
pairList.setAnaphor(m);
NonEmptyFSList head = new NonEmptyFSList(jcas);
pairList.setAntecedentList(head);
NonEmptyFSList tail = null;
for (int q = p-1; q>=0; --q) {
Markable a = (Markable) lm.get(q); // Candidate antecedent
// Don't link to a expletive
// if (dnr.contains(m)) continue;
// Look no more than 10 sentences
int sentdist = sentDist(jcas, a, m);
if (sentdist>CorefConsts.NEDIST) break;
// else if (sentdist>PRODIST && m instanceof PronounMarkable) continue;
// filter out if both are NEs but of diff types
if (m.getContent() instanceof IdentifiedAnnotation &&
a.getContent() instanceof IdentifiedAnnotation &&
((IdentifiedAnnotation)m.getContent()).getTypeID() != ((IdentifiedAnnotation)a.getContent()).getTypeID())
continue;
// filter out "which" that crosses sentence boundary
if (a.getCoveredText().equalsIgnoreCase("which") &&
sentDist(jcas, a, m)>=1)
continue;
// ban pairs that one markable is a sub/superspan of the other
if ((a.getBegin()<=m.getBegin() && a.getEnd()>=m.getEnd()) ||
m.getBegin()<=a.getBegin() && m.getEnd()>=a.getEnd())
continue;
// Create a vector
BooleanLabeledFS labeledAntecedent = new BooleanLabeledFS(jcas);
labeledAntecedent.setFeature(a);
if(tail == null){
tail = head;
}else{
tail.setTail(new NonEmptyFSList(jcas));
tail = (NonEmptyFSList) tail.getTail();
}
tail.setHead(labeledAntecedent);
// if (isGoldPair(a, m)){
// labeledAntecedent.setLabel(true);
// // FIXME this cannot be done, it's implicitly looking at the label and changing the possible outcomes...
// break; // stop if a gold pair is found
// }else{
// labeledAntecedent.setLabel(false);
// }
}
if(tail == null) pairList.setAntecedentList(new EmptyFSList(jcas));
else tail.setTail(new EmptyFSList(jcas));
numVecs++;
pairList.addToIndexes();
}