src/PredFinder/inference/EIUtils.cpp
//////////////////////////////
//                          //
// LOCATION-RELATED METHODS //
//   -- for class           //
//   -- for document        //
//                          //
//////////////////////////////

LOCATION-RELATED METHODS
for class
for document
LOCATION - RELATED METHODS for class for document
void EIUtils::readSTOPSeparatedSubLocationFile(const std::string & file_name, 
		std::set<std::wstring>& strings_in_table, 
		std::map<std::wstring, std::vector<std::wstring> >& expansion_table){
	boost::scoped_ptr<UTF8InputStream> inStream_scoped_ptr(UTF8InputStream::build(file_name.c_str()));
	UTF8InputStream& inStream(*inStream_scoped_ptr);
	std::wstring line;
	while (getline(inStream, line)) {
		std::vector<std::wstring> parts;
		boost::algorithm::split_regex(parts, line, boost::basic_regex<wchar_t>(L":STOP"));
		if (parts.size() > 1) {
			std::wstring base_name = parts[0];
			boost::trim(base_name);
			strings_in_table.insert(base_name);
			std::wstring first_sub = parts[1];
			boost::trim(first_sub);
			size_t space_index = first_sub.find(L" ");
			if (space_index == std::wstring::npos) {
				SessionLogger::warn("LEARNIT") << "ignoring ill-formed line in expansions file: " 
					<< file_name << ", \nline: " << line << std::endl;
				continue;
			}
			first_sub = first_sub.substr(space_index);
			boost::trim(first_sub);
			std::vector<std::wstring> subLocations;
			subLocations.push_back(first_sub);
			strings_in_table.insert(first_sub);
			for (size_t i = 2; i < parts.size(); i++) {	
				std::wstring sub = parts.at(i);
				boost::trim(sub);
				subLocations.push_back(sub);
				strings_in_table.insert(sub);
			}
			expansion_table[base_name] = subLocations;
		} else if (line.length() > 0)  {
			SessionLogger::warn("LEARNIT") << "ignoring ill-formed line in location expansions file: " << 
				file_name << ", \nline: " << line << std::endl;
		}
	}
	inStream.close();
}
void EIUtils :: readSTOPSeparatedSubLocationFile ( const std :: string & file_name , std :: set < std :: wstring > & strings_in_table , std :: map < std :: wstring , std :: vector < std :: wstring > > & expansion_table ) { boost :: scoped_ptr < UTF8InputStream > inStream_scoped_ptr ( UTF8InputStream :: build ( file_name . c_str ( ) ) ) ; UTF8InputStream & inStream ( * inStream_scoped_ptr ) ; std :: wstring line ; while ( getline ( inStream , line ) ) { std :: vector < std :: wstring > parts ; boost :: algorithm :: split_regex ( parts , line , boost :: basic_regex < wchar_t > ( L" " ) ) ; if ( parts . size ( ) > 1 ) { std :: wstring base_name = parts [ 0 ] ; boost :: trim ( base_name ) ; strings_in_table . insert ( base_name ) ; std :: wstring first_sub = parts [ 1 ] ; boost :: trim ( first_sub ) ; size_t space_index = first_sub . find ( L" " ) ; if ( space_index == std :: wstring :: npos ) { SessionLogger :: warn ( " " ) << " " << file_name << " \n " << line << std :: endl ; continue ; } first_sub = first_sub . substr ( space_index ) ; boost :: trim ( first_sub ) ; std :: vector < std :: wstring > subLocations ; subLocations . push_back ( first_sub ) ; strings_in_table . insert ( first_sub ) ; for ( size_t i = 2 ; i < parts . size ( ) ; i ++ ) { std :: wstring sub = parts . at ( i ) ; boost :: trim ( sub ) ; subLocations . push_back ( sub ) ; strings_in_table . insert ( sub ) ; } expansion_table [ base_name ] = subLocations ; } else if ( line . length ( ) > 0 ) { SessionLogger :: warn ( " " ) << " " << file_name << " \n " << line << std :: endl ; } } inStream . close ( ) ; }
LOCATION-RELATED METHODS 
 for class           
 for document
LOCATION - RELATED METHODS for class for document
// have to get rid of integer
