Esempio n. 1
0
int main() 
{
	ifstream infile( "alice_emma" );

	istream_iterator<string> ifile( infile );
	istream_iterator<string> eos;

	vector< string > text;
	copy( ifile, eos, inserter( text, text.begin() ));

	string filt_elems( "\",.?;:" );
	filter_string( text.begin(), text.end(), filt_elems );

	vector<string>::iterator iter;

	sort( text.begin(), text.end() );
	iter = unique( text.begin(), text.end() );
	text.erase( iter, text.end() );
	
	ofstream outfile( "alice_emma_sort" );

	iter = text.begin();
	for ( int line_cnt = 1; iter != text.end(); ++iter, ++line_cnt ) 
	{
		outfile << *iter << " ";
		if ( ! ( line_cnt % 8 ))
	     		outfile << '\n';
	}
}
Esempio n. 2
0
int main() 
{
	vector<string,allocator>   *text_file      = retrieve_text();
        text_loc 		   *text_locations = separate_words( text_file );

        string filt_elems( "\",.;:!?)(" );
        filter_text( text_locations->first, filt_elems );
        suffix_text( text_locations->first );	
	strip_caps(  text_locations->first );

	map<string,loc*,less<string>,allocator> *text_map = build_word_map( text_locations );
        query_text( text_file, text_map );

	return 0;
}
Esempio n. 3
0
int main() 
{
	vector<string,allocator>   *text_file      = retrieve_text();
        text_loc 		   *text_locations = separate_words( text_file );

        string filt_elems( "\",.;:!?)(" );
        filter_text( text_locations->first, filt_elems );

	ostream_iterator< string > output( cout, "\n" );

	cout << "----------- about to generate text read --------------\n";
        copy( text_file->begin(), text_file->end(), output );

	cout << "-------- about to generate word and location data ----\n";
	display_text_locations( text_locations );

	return 0;
}