src/PredFinder/common/ElfMultiDoc.cpp
/**
 * Called by get_mapped_arg() to handle the case where there is no matching bound URI in the string replacement table.
 * Note that the method has no bound_uri_out parameter.
 * @param best_name Best name to match
 * @param type_string Type string
 * @param doc_theory DocTheory (used to retrieve an EntitySet)
 * @param xdoc_id_out XDoc ID found (will be the invalid XDoc ID if none is found)
 * @return String representation of xdoc_id_out, which will be an empty string if XDoc ID represents the invalid XDoc ID.
 **/
Called by get_mapped_arg() to handle the case where there is no matching bound URI in the string replacement table.
Note that the method has no bound_uri_out parameter.
Called by get_mapped_arg () to handle the case where there is no matching bound URI in the string replacement table . Note that the method has no bound_uri_out parameter .
std::wstring ElfMultiDoc::get_mapped_arg_when_no_srm_entry_found(const std::wstring & best_name, 
																 const std::wstring & type_string, 
																 const DocTheory* doc_theory, const Entity* entity,
																 XDocIdType & xdoc_id_out) {
	xdoc_id_out = XDocIdType();
	if (entity) {
		bool entity_has_name = false;
		const EntitySet* entity_set = doc_theory->getEntitySet();
		for(int i = 0; i < entity->getNMentions(); i++){
			const Mention * ment = entity_set->getMention(entity->getMention(i));
			if((ment != 0) && ment->getMentionType() == Mention::NAME){
				entity_has_name = true;
				break;
			}
		}
		if(!entity_has_name)
			return L"";
		Symbol entity_type = entity->getType().getName();
		XDocIdType best_uri = ElfMultiDoc::get_xdoc_id(entity_type, best_name);
		if (best_uri.is_valid()) {
            xdoc_id_out = best_uri;
			return best_uri.as_string();
        }
		PotentialXdocIdToCountAndGreatestLengthMap potential_ids;
		collect_potential_xdoc_ids(entity_set, entity, entity_type, potential_ids);
		xdoc_id_out = get_best_potential_xdoc_id(entity, potential_ids, best_uri);
		return xdoc_id_out.as_string();
	} else {
		if (type_string != L"ic:Position") {
			Symbol entity_type(L"NONE");
			xdoc_id_out = get_xdoc_id_and_entity_type(best_name, entity_type);
            return xdoc_id_out.as_string();
		}
	}
	return L"";
}
std :: wstring ElfMultiDoc :: get_mapped_arg_when_no_srm_entry_found ( const std :: wstring & best_name , const std :: wstring & type_string , const DocTheory * doc_theory , const Entity * entity , XDocIdType & xdoc_id_out ) { xdoc_id_out = XDocIdType ( ) ; if ( entity ) { bool entity_has_name = false ; const EntitySet * entity_set = doc_theory -> getEntitySet ( ) ; for ( int i = 0 ; i < entity -> getNMentions ( ) ; i ++ ) { const Mention * ment = entity_set -> getMention ( entity -> getMention ( i ) ) ; if ( ( ment != 0 ) && ment -> getMentionType ( ) == Mention :: NAME ) { entity_has_name = true ; break ; } } if ( ! entity_has_name ) return L" " ; Symbol entity_type = entity -> getType ( ) . getName ( ) ; XDocIdType best_uri = ElfMultiDoc :: get_xdoc_id ( entity_type , best_name ) ; if ( best_uri . is_valid ( ) ) { xdoc_id_out = best_uri ; return best_uri . as_string ( ) ; } PotentialXdocIdToCountAndGreatestLengthMap potential_ids ; collect_potential_xdoc_ids ( entity_set , entity , entity_type , potential_ids ) ; xdoc_id_out = get_best_potential_xdoc_id ( entity , potential_ids , best_uri ) ; return xdoc_id_out . as_string ( ) ; } else { if ( type_string != L" " ) { Symbol entity_type ( L" " ) ; xdoc_id_out = get_xdoc_id_and_entity_type ( best_name , entity_type ) ; return xdoc_id_out . as_string ( ) ; } } return L" " ; }
Called by get_mapped_arg() to handle the case where there is no matching bound URI in the string replacement table.
Called by get_mapped_arg () to handle the case where there is no matching bound URI in the string replacement table .
//   Don't necessarily want to restrict ourselves to a specific type string.  What should we do about this?
 //   Note: could add all mapped args to the simpler table, and search all entity types
 //MRF: Only do XDoc look-up if there was a name in the entity.  We don't know if best_name is actually a description.
 // Get the associated entity's ACE type and try a direct cluster lookup
 // This is an ACE entity; check the name strings of other coreferent mentions.
 // Different mentions in the entity may have different cluster ids.
 // Collect all matches, then resolve. We'll choose the URI that is used most often
 // (highest count) and/or corresponds to the mention head with the greatest 
 // number of words (greatest length).
 // Make sure we're not replacing individual IDs for certain types
 // We have an orphan name string (no associated entity), so we might as well try against all types. 
 // Take the first match found.
 // No match
