src/Generic/edt/discmodel/DTNameLinker.cpp
// set up to link. This method doesn't do any of the actual processing - it just provides a way
// for multiple paths to get through

set up to link. This method doesn't do any of the actual processing - it just provides a way
for multiple paths to get through
set up to link . This method doesn ' t do any of the actual processing - it just provides a way for multiple paths to get through
int DTNameLinker::linkMention (LexEntitySet * currSolution, MentionUID currMentionUID,
								 EntityType linkType, LexEntitySet *results[], 
								 int max_results)
{
	LexEntitySet *newSet = NULL;
	EntityGuess guesses[64];
	Mention *currMention = currSolution->getMention(currMentionUID);
	if (_use_rules)
		_simpleRuleNameLinker->setCurrSolution(currSolution);
	_debugStream << L"\nPROCESSING Mention #" << currMention->getUID() << L": ";
	_debugStream << currMention->getNode()->toTextString() << L"\n";
	int nGuesses = guessEntity(currSolution, currMention, linkType, guesses, 
								max_results>64 ? 64: max_results);
	for (int i = 0; i < nGuesses; i++) {
		newSet = currSolution->fork();
		if (guesses[i].id == EntityGuess::NEW_ENTITY ||
			!guesses[i].type.isRecognized()) { 
			if (!guesses[i].type.isRecognized())
				_debugStream << L"OUTCOME: NOT CREATING A NEW ENTITY BECAUSE OF LINKING TO NON-ACE ENTITY #"<<guesses[i].id<<"\n";
			else {
				newSet->addNew(currMention->getUID(), linkType);
				_debugStream << L"OUTCOME: CREATED NEW ENTITY #" << newSet->getNEntities() - 1 << "\n";
			}
		}
		else {
			newSet->add(currMention->getUID(), guesses[i].id);
			Mention *newMention = newSet->getMention(currMention->getUID());
			if(!_filter_by_entity_type && newMention->getEntityType()!=guesses[i].type) {
				newMention->setEntityType(guesses[i].type);
				newMention->setEntitySubtype(EntitySubtype::getDefaultSubtype(guesses[i].type));
			}
			_debugStream << L"OUTCOME: LINKED TO ENTITY #"  << guesses[i].id << " score: "<< guesses[i].score <<"\n";
		}
		newSet->setScore(newSet->getScore() + static_cast<float>(guesses[i].score));
		results[i] = newSet;
		newSet->customDebugPrint(_debugStream);
	}
	_debugStream << L"\nDONE PROCESSING MENTION #" << currMention->getUID() << "\n\n";
	return nGuesses;
}
int DTNameLinker :: linkMention ( LexEntitySet * currSolution , MentionUID currMentionUID , EntityType linkType , LexEntitySet * results [ ] , int max_results ) { LexEntitySet * newSet = NULL ; EntityGuess guesses [ 64 ] ; Mention * currMention = currSolution -> getMention ( currMentionUID ) ; if ( _use_rules ) _simpleRuleNameLinker -> setCurrSolution ( currSolution ) ; _debugStream << L" \n " << currMention -> getUID ( ) << L" " ; _debugStream << currMention -> getNode ( ) -> toTextString ( ) << L" \n " ; int nGuesses = guessEntity ( currSolution , currMention , linkType , guesses , max_results > 64 ? 64 : max_results ) ; for ( int i = 0 ; i < nGuesses ; i ++ ) { newSet = currSolution -> fork ( ) ; if ( guesses [ i ] . id == EntityGuess :: NEW_ENTITY || ! guesses [ i ] . type . isRecognized ( ) ) { if ( ! guesses [ i ] . type . isRecognized ( ) ) _debugStream << L" " << guesses [ i ] . id << " \n " ; else { newSet -> addNew ( currMention -> getUID ( ) , linkType ) ; _debugStream << L" " << newSet -> getNEntities ( ) - 1 << " \n " ; } } else { newSet -> add ( currMention -> getUID ( ) , guesses [ i ] . id ) ; Mention * newMention = newSet -> getMention ( currMention -> getUID ( ) ) ; if ( ! _filter_by_entity_type && newMention -> getEntityType ( ) != guesses [ i ] . type ) { newMention -> setEntityType ( guesses [ i ] . type ) ; newMention -> setEntitySubtype ( EntitySubtype :: getDefaultSubtype ( guesses [ i ] . type ) ) ; } _debugStream << L" " << guesses [ i ] . id << " " << guesses [ i ] . score << " \n " ; } newSet -> setScore ( newSet -> getScore ( ) + static_cast < float > ( guesses [ i ] . score ) ) ; results [ i ] = newSet ; newSet -> customDebugPrint ( _debugStream ) ; } _debugStream << L" \n " << currMention -> getUID ( ) << " \n \n " ; return nGuesses ; }
set up to link.
set up to link .
// when used with non-ACE candidates for no-link
