src/Generic/edt/discmodel/CorefUtils.cpp
/**
 *  Of all of the mentions in <code>ent</code> that will be linked before 
 *  <code>ment</code> chronologically, find the one that linked last. 
 *  
 *  @param currSolution the current working EntitySet
 *  @param ent the Entity whose Mention we want to identify
 *  @param ment the target Mention
 *  @return the id of the closest Mention or -1 if none found
 */
Of all of the mentions in ent that will be linked before
ment chronologically, find the one that linked last.

@param currSolution the current working EntitySet
@param ent the Entity whose Mention we want to identify
@param ment the target Mention
@return the id of the closest Mention or -1 if none found
Of all of the mentions in ent that will be linked before ment chronologically find the one that linked last . @param currSolution the current working EntitySet @param ent the Entity whose Mention we want to identify @param ment the target Mention @return the id of the closest Mention or - 1 if none found
MentionUID CorefUtils::getLatestMention(const EntitySet *currSolution, const Entity* ent, const Mention *ment) {
	MentionUID lastID;
	for (int j = 0; j < ent->getNMentions(); j++) {
		if (ent->getMention(j) > lastID) {
			Mention * entMention = currSolution->getMention(ent->getMention(j));
			if (ent->getMention(j) < ment->getUID()) {
				lastID = ent->getMention(j);
			}
			else if (entMention != 0 && entMention->getSentenceNumber() == ment->getSentenceNumber()) {
				Mention::Type entMentionType = entMention->getMentionType();
				Mention::Type mentType = ment->getMentionType();
				if (entMentionType == Mention::NAME &&
					(mentType == Mention::DESC || mentType == Mention::PRON))
					lastID = ent->getMention(j);
				else if (entMentionType == Mention::DESC && mentType == Mention::PRON) 
					lastID = ent->getMention(j);
			}
		}
	}
	return lastID;
}
MentionUID CorefUtils :: getLatestMention ( const EntitySet * currSolution , const Entity * ent , const Mention * ment ) { MentionUID lastID ; for ( int j = 0 ; j < ent -> getNMentions ( ) ; j ++ ) { if ( ent -> getMention ( j ) > lastID ) { Mention * entMention = currSolution -> getMention ( ent -> getMention ( j ) ) ; if ( ent -> getMention ( j ) < ment -> getUID ( ) ) { lastID = ent -> getMention ( j ) ; } else if ( entMention != 0 && entMention -> getSentenceNumber ( ) == ment -> getSentenceNumber ( ) ) { Mention :: Type entMentionType = entMention -> getMentionType ( ) ; Mention :: Type mentType = ment -> getMentionType ( ) ; if ( entMentionType == Mention :: NAME && ( mentType == Mention :: DESC || mentType == Mention :: PRON ) ) lastID = ent -> getMention ( j ) ; else if ( entMentionType == Mention :: DESC && mentType == Mention :: PRON ) lastID = ent -> getMention ( j ) ; } } } return lastID ; }
Of all of the mentions in <code>ent</code> that will be linked before
  <code>ment</code> chronologically, find the one that linked last.
Of all of the mentions in <code > ent< / code > that will be linked before <code > ment< / code > chronologically find the one that linked last .
// Coref links all names in a sentence, then all descriptors, then all pronouns, so we need to
 // make an exception for mentions that appear in the same sentence as the target mention.
