src/Generic/apf/APF4GenericResultCollector.cpp
// mention must be a name, must have a parent whose edt head is different
// and must have a parent whose entity is different

mention must be a name, must have a parent whose edt head is different
and must have a parent whose entity is different
mention must be a name must have a parent whose edt head is different and must have a parent whose entity is different
bool APF4GenericResultCollector::_isNameNotInHeadOfParent(const Mention* ment, EntityType type)
{
	if (ment->mentionType != Mention::NAME)
		return false;
	const SynNode* node = ment->node;
	const SynNode* parent = node->getParent();
	if (parent != 0 && parent->hasMention()) {		
		Mention* parMent = _entitySet->getMentionSet(ment->getSentenceNumber())->getMentionByNode(parent);
		if (parMent->getEDTHead() == node)
			return false;
		if (parMent->isPopulated()) {
			Entity* parEnt = _entitySet->getEntityByMention(parMent->getUID(), type);
			if (parEnt == 0) 
				return true;
			Entity* ent = _entitySet->getEntityByMention(ment->getUID(), type);
			if (ent == 0)
				throw InternalInconsistencyException("APF4GenericResultCollector::_isNameNotInHeadOfParent()",
				"current mention has no entity!");
			if (parEnt->getID() == ent->getID())
				return false;
		}
	}
	return true;
}
bool APF4GenericResultCollector :: _isNameNotInHeadOfParent ( const Mention * ment , EntityType type ) { if ( ment -> mentionType != Mention :: NAME ) return false ; const SynNode * node = ment -> node ; const SynNode * parent = node -> getParent ( ) ; if ( parent != 0 && parent -> hasMention ( ) ) { Mention * parMent = _entitySet -> getMentionSet ( ment -> getSentenceNumber ( ) ) -> getMentionByNode ( parent ) ; if ( parMent -> getEDTHead ( ) == node ) return false ; if ( parMent -> isPopulated ( ) ) { Entity * parEnt = _entitySet -> getEntityByMention ( parMent -> getUID ( ) , type ) ; if ( parEnt == 0 ) return true ; Entity * ent = _entitySet -> getEntityByMention ( ment -> getUID ( ) , type ) ; if ( ent == 0 ) throw InternalInconsistencyException ( " " , " " ) ; if ( parEnt -> getID ( ) == ent -> getID ( ) ) return false ; } } return true ; }
mention must be a name, must have a parent whose edt head is different
and must have a parent whose entity is different
mention must be a name must have a parent whose edt head is different and must have a parent whose entity is different
// check head
 // if possible, check entities
 // parent is not an entity
