src/PredFinder/elf/ElfDocument.cpp
/**
 * For a specified type, collects all of the individuals
 * that have that type, collects all of the relations
 * relevant to those individuals, and then clusters
 * individuals together.
 *
 * @param domain_prefix The domain we're in, used to determine
 * clustering strategy.
 * @param coreferent_types A list of individuals that should be
 * candidates for clustering.
 *
 * @author nward@bbn.com
 * @date 2010.08.19
 **/
For a specified type, collects all of the individuals
that have that type, collects all of the relations
relevant to those individuals, and then clusters
individuals together.

@param domain_prefix The domain we're in, used to determine
clustering strategy.
@param coreferent_types A list of individuals that should be
candidates for clustering.


For a specified type collects all of the individuals that have that type collects all of the relations relevant to those individuals and then clusters individuals together . @param domain_prefix The domain we ' re in used to determine clustering strategy . @param coreferent_types A list of individuals that should be candidates for clustering .
void ElfDocument::do_document_level_individual_coreference(const std::wstring& domain_prefix, 
														   const std::vector<std::wstring> & coreferent_types) {
	ElfIndividualCoreference_ptr coref_engine = boost::make_shared<ElfIndividualCoreference>(domain_prefix);
	ElfIndividualSet individuals_to_coref;
	if (coreferent_types.size() > 0) {
		BOOST_FOREACH(std::wstring coreferent_type, coreferent_types) {
			if (coreferent_type != L"") {
				ElfIndividualSet typed_individuals_to_coref = get_merged_individuals_by_type(coreferent_type);
				BOOST_FOREACH(ElfIndividual_ptr typed_individual, typed_individuals_to_coref) {
					individuals_to_coref.insert(typed_individual);
				}
			}
		}
	}
	BOOST_FOREACH(ElfIndividual_ptr individual, individuals_to_coref) {
		ElfRelationMap relations_for_individual = get_relations_by_individual(individual);
		coref_engine->add_cluster_member(individual, relations_for_individual);
	}
	coref_engine->combine_clusters();
	ElfIndividualUriMap clustered_individual_uri_map = coref_engine->get_individual_to_cluster_uri_map(_id);
	replace_individual_uris(clustered_individual_uri_map);
}
void ElfDocument :: do_document_level_individual_coreference ( const std :: wstring & domain_prefix , const std :: vector < std :: wstring > & coreferent_types ) { ElfIndividualCoreference_ptr coref_engine = boost :: make_shared < ElfIndividualCoreference > ( domain_prefix ) ; ElfIndividualSet individuals_to_coref ; if ( coreferent_types . size ( ) > 0 ) { BOOST_FOREACH ( std :: wstring coreferent_type , coreferent_types ) { if ( coreferent_type != L" " ) { ElfIndividualSet typed_individuals_to_coref = get_merged_individuals_by_type ( coreferent_type ) ; BOOST_FOREACH ( ElfIndividual_ptr typed_individual , typed_individuals_to_coref ) { individuals_to_coref . insert ( typed_individual ) ; } } } } BOOST_FOREACH ( ElfIndividual_ptr individual , individuals_to_coref ) { ElfRelationMap relations_for_individual = get_relations_by_individual ( individual ) ; coref_engine -> add_cluster_member ( individual , relations_for_individual ) ; } coref_engine -> combine_clusters ( ) ; ElfIndividualUriMap clustered_individual_uri_map = coref_engine -> get_individual_to_cluster_uri_map ( _id ) ; replace_individual_uris ( clustered_individual_uri_map ) ; }
For a specified type, collects all of the individuals
 that have that type, collects all of the relations
 relevant to those individuals, and then clusters
 individuals together.
For a specified type collects all of the individuals that have that type collects all of the relations relevant to those individuals and then clusters individuals together .
// Initialize the individual coreference engine
 // Get all of the individuals that have the specified types (or all individuals if none)
 //SessionLogger::info("LEARNIT") << "individuals: " << individuals_to_coref.size() << std::endl;
 // For each individual, collect all of its relevant relations
 // Get the relations for this individual (recursive)
 //SessionLogger::info("LEARNIT") << individual_pair.first << " relation predicates: " << relations_for_individual.size() << std::endl;
 // Create a new cluster member and add it
 // Do the meat of the coreference
 // Get the map of old individual generated URIs to new cluster generated URIs (reflecting cluster membership)
 //SessionLogger::info("LEARNIT") << "Clustered " << clustered_individual_uri_map.size() << " Individuals" << std::endl;
 //BOOST_FOREACH(ElfIndividualUriMap::value_type individual_pair, clustered_individual_uri_map) {
 //	SessionLogger::info("LEARNIT") << individual_pair.first << " -> " << individual_pair.second << std::endl;
 //}
 // Update all of the changed individual URIs
