src/PredFinder/common/ElfMultiDoc.cpp
/**
 * This method disambiguates between the New York Giants and the New York Jets.
 * New York is the only city with more than one NFL team.
 * Since teams are always represented by bound URIs, we don't need to handle XDoc IDs here.
 * @param doc_theory Pointer to the DocTheory (allows us to retrieve information about the doc).
 * @return String representing bound URI (or empty string).
 **/
This method disambiguates between the New York Giants and the New York Jets.
New York is the only city with more than one NFL team.
Since teams are always represented by bound URIs, we don't need to handle XDoc IDs here.
@param doc_theory Pointer to the DocTheory (allows us to retrieve information about the doc).
@return String representing bound URI (or empty string).
This method disambiguates between the New York Giants and the New York Jets . New York is the only city with more than one NFL team . Since teams are always represented by bound URIs we don ' t need to handle XDoc IDs here . @param doc_theory Pointer to the DocTheory ( allows us to retrieve information about the doc ) . @return String representing bound URI ( or empty string ) .
std::wstring ElfMultiDoc::get_best_name_for_ny_nfl_team(const DocTheory* doc_theory) {
	if(doc_theory == 0)
		return L"";
	const EntitySet* entity_set = doc_theory->getEntitySet();
	bool found_jets = false;
	bool found_giants = false;
	for(int i = 0; i < entity_set->getNEntities(); i++){
		const Entity* entity = entity_set->getEntity(i);
		for(int m = 0; m < entity->getNMentions(); m++){
			const Mention* ment = entity_set->getMention(entity->getMention(m));
			std::wstring ment_str = ment->getNode()->toTextString();
			ment_str = UnicodeUtil::normalizeTextString(ment_str);
			if(!found_jets && ment_str.find(L"jets") != std::wstring::npos){
				found_jets = true;
			}
			if(!found_giants && ment_str.find(L"giants") != std::wstring::npos){
				found_giants = true;
			}
		}
	}
	if(found_jets && !found_giants){
		return find_bound_uri_from_name_w_or_wo_docid(L"jets", doc_theory->getDocument()->getName().to_string());
	}
	if(found_giants && !found_jets){
		return find_bound_uri_from_name_w_or_wo_docid(L"giants", doc_theory->getDocument()->getName().to_string());
	}
	return L"";
}
std :: wstring ElfMultiDoc :: get_best_name_for_ny_nfl_team ( const DocTheory * doc_theory ) { if ( doc_theory == 0 ) return L" " ; const EntitySet * entity_set = doc_theory -> getEntitySet ( ) ; bool found_jets = false ; bool found_giants = false ; for ( int i = 0 ; i < entity_set -> getNEntities ( ) ; i ++ ) { const Entity * entity = entity_set -> getEntity ( i ) ; for ( int m = 0 ; m < entity -> getNMentions ( ) ; m ++ ) { const Mention * ment = entity_set -> getMention ( entity -> getMention ( m ) ) ; std :: wstring ment_str = ment -> getNode ( ) -> toTextString ( ) ; ment_str = UnicodeUtil :: normalizeTextString ( ment_str ) ; if ( ! found_jets && ment_str . find ( L" " ) != std :: wstring :: npos ) { found_jets = true ; } if ( ! found_giants && ment_str . find ( L" " ) != std :: wstring :: npos ) { found_giants = true ; } } } if ( found_jets && ! found_giants ) { return find_bound_uri_from_name_w_or_wo_docid ( L" " , doc_theory -> getDocument ( ) -> getName ( ) . to_string ( ) ) ; } if ( found_giants && ! found_jets ) { return find_bound_uri_from_name_w_or_wo_docid ( L" " , doc_theory -> getDocument ( ) -> getName ( ) . to_string ( ) ) ; } return L" " ; }
This method disambiguates between the New York Giants and the New York Jets.
This method disambiguates between the New York Giants and the New York Jets .