src/English/descriptors/en_CompoundMentionFinder.cpp
// NOTE: mentions can be modified here. It's one of the only places in this class!

mentions can be modified here. It's one of the only places in this class!
mentions can be modified here . It ' s one of the only places in this class!
void EnglishCompoundMentionFinder::coerceAppositiveMemberMentions(Mention** mentions)
{
	if (_use_correct_answers) {
		if (mentions[1]->mentionType == Mention::NAME && mentions[0]->mentionType == Mention::DESC) {
			mentions[0]->setEntityType(mentions[1]->getEntityType());
			mentions[0]->setEntitySubtype(mentions[1]->getEntitySubtype());
		}
		else if (mentions[0]->mentionType == Mention::NAME && mentions[1]->mentionType == Mention::DESC) {
			mentions[1]->setEntityType(mentions[0]->getEntityType());
			mentions[1]->setEntitySubtype(mentions[0]->getEntitySubtype());
		}
		return;
	}
	if (mentions[0]->getEntityType() == mentions[1]->getEntityType())
		return;
	if (mentions[0]->mentionType == Mention::PRON) {
		mentions[0]->setEntityType(mentions[1]->getEntityType());
		mentions[0]->setEntitySubtype(mentions[1]->getEntitySubtype());
	}
	else if (mentions[1]->mentionType == Mention::PRON) {
		mentions[1]->setEntityType(mentions[0]->getEntityType());
		mentions[1]->setEntitySubtype(mentions[0]->getEntitySubtype());
	}
	if (mentions[0]->mentionType == Mention::NAME && mentions[1]->mentionType == Mention::DESC) {
		int numTypes = 0;
		const Symbol* types = _descWordMap->lookup(mentions[1]->node->getHeadWord(), numTypes);
		int i;
		for (i = 0; i < numTypes; i++) {
			if (types[i] == mentions[0]->getEntityType().getName()) {
				mentions[1]->setEntityType(mentions[0]->getEntityType());
				mentions[1]->setEntitySubtype(mentions[0]->getEntitySubtype());
				return;
			}
		}
	}
	else if (mentions[1]->mentionType == Mention::NAME && mentions[0]->mentionType == Mention::DESC) {
		int numTypes = 0;
		const Symbol* types = _descWordMap->lookup(mentions[0]->node->getHeadWord(), numTypes);
		int i;
		for (i = 0; i < numTypes; i++) {
			if (types[i] == mentions[1]->getEntityType().getName()) {
				mentions[0]->setEntityType(mentions[1]->getEntityType());
				mentions[0]->setEntitySubtype(mentions[1]->getEntitySubtype());
				return;
			}
		}
	}
}
void EnglishCompoundMentionFinder :: coerceAppositiveMemberMentions ( Mention * * mentions ) { if ( _use_correct_answers ) { if ( mentions [ 1 ] -> mentionType == Mention :: NAME && mentions [ 0 ] -> mentionType == Mention :: DESC ) { mentions [ 0 ] -> setEntityType ( mentions [ 1 ] -> getEntityType ( ) ) ; mentions [ 0 ] -> setEntitySubtype ( mentions [ 1 ] -> getEntitySubtype ( ) ) ; } else if ( mentions [ 0 ] -> mentionType == Mention :: NAME && mentions [ 1 ] -> mentionType == Mention :: DESC ) { mentions [ 1 ] -> setEntityType ( mentions [ 0 ] -> getEntityType ( ) ) ; mentions [ 1 ] -> setEntitySubtype ( mentions [ 0 ] -> getEntitySubtype ( ) ) ; } return ; } if ( mentions [ 0 ] -> getEntityType ( ) == mentions [ 1 ] -> getEntityType ( ) ) return ; if ( mentions [ 0 ] -> mentionType == Mention :: PRON ) { mentions [ 0 ] -> setEntityType ( mentions [ 1 ] -> getEntityType ( ) ) ; mentions [ 0 ] -> setEntitySubtype ( mentions [ 1 ] -> getEntitySubtype ( ) ) ; } else if ( mentions [ 1 ] -> mentionType == Mention :: PRON ) { mentions [ 1 ] -> setEntityType ( mentions [ 0 ] -> getEntityType ( ) ) ; mentions [ 1 ] -> setEntitySubtype ( mentions [ 0 ] -> getEntitySubtype ( ) ) ; } if ( mentions [ 0 ] -> mentionType == Mention :: NAME && mentions [ 1 ] -> mentionType == Mention :: DESC ) { int numTypes = 0 ; const Symbol * types = _descWordMap -> lookup ( mentions [ 1 ] -> node -> getHeadWord ( ) , numTypes ) ; int i ; for ( i = 0 ; i < numTypes ; i ++ ) { if ( types [ i ] == mentions [ 0 ] -> getEntityType ( ) . getName ( ) ) { mentions [ 1 ] -> setEntityType ( mentions [ 0 ] -> getEntityType ( ) ) ; mentions [ 1 ] -> setEntitySubtype ( mentions [ 0 ] -> getEntitySubtype ( ) ) ; return ; } } } else if ( mentions [ 1 ] -> mentionType == Mention :: NAME && mentions [ 0 ] -> mentionType == Mention :: DESC ) { int numTypes = 0 ; const Symbol * types = _descWordMap -> lookup ( mentions [ 0 ] -> node -> getHeadWord ( ) , numTypes ) ; int i ; for ( i = 0 ; i < numTypes ; i ++ ) { if ( types [ i ] == mentions [ 1 ] -> getEntityType ( ) . getName ( ) ) { mentions [ 0 ] -> setEntityType ( mentions [ 1 ] -> getEntityType ( ) ) ; mentions [ 0 ] -> setEntitySubtype ( mentions [ 1 ] -> getEntitySubtype ( ) ) ; return ; } } } }
NOTE: mentions can be modified here.
NOTE : mentions can be modified here .
// if one mention is a pron, coerce the other into its type
 // assume appositive sizes of 2
 // if we have a name, desc pair,
 // if the type of the name is valid for the head of the desc, coerce
 // else nothing to do
