boolean referentFound = false;
boolean hasReferentialCandidate = false;
boolean nonReferentFound = false;
for (int ei = 0; ei < getNumEntities(dm); ei++) {
DiscourseEntity cde = dm.getEntity(ei);
MentionContext entityMention = cde.getLastExtent();
if (outOfRange(mention, cde)) {
if (mention.getId() != -1 && !referentFound) {
//System.err.println("retain: Referent out of range: "+ec.toText()+" "+ec.parse.getSpan());
}
break;
}
if (excluded(mention, cde)) {
if (showExclusions) {
if (mention.getId() != -1 && entityMention.getId() == mention.getId()) {
System.err.println(this +".retain: Referent excluded: (" + mention.getId() + ") " + mention.toText() + " " + mention.getIndexSpan() + " -> (" + entityMention.getId() + ") " + entityMention.toText() + " " + entityMention.getSpan() + " " + this);
}
}
}
else {
hasReferentialCandidate = true;
boolean useAsDifferentExample = defaultReferent(cde);
//if (!sampleSelection || (mention.getId() != -1 && entityMention.getId() == mention.getId()) || (!nonReferentFound && useAsDifferentExample)) {
List<String> features = getFeatures(mention, cde);
//add Event to Model
if (debugOn) {
System.err.println(this +".retain: " + mention.getId() + " " + mention.toText() + " -> " + entityMention.getId() + " " + cde);
}
if (mention.getId() != -1 && entityMention.getId() == mention.getId()) {
referentFound = true;
events.add(new Event(SAME, features.toArray(new String[features.size()])));
de = cde;
//System.err.println("MaxentResolver.retain: resolved at "+ei);
distances.add(ei);