create_lists.cpp
void remove_placenames() {
    word_occ ptr;

    // catalogue starting data for analysis purposes
    std::cout << "Removing placenames." << '\n';
    std::cout << "Starting list size is: " << words_vector.size() << '\n';
    int start = words_vector.size();

    // create new vector of placenames, this will go out of scope when the function completes
    std::vector<std::string> placenames;
    std::ifstream placenames_list;
    placenames_list.open("placenames.txt");

    std::string line;
    std::string place;
    while (getline(placenames_list, line)) {
        std::istringstream ss(line);
        ss >> place;

        placenames.push_back(place);
    }

    // for each word in the master list, check if it also exists in the list of placenames
    for (std::vector<word_occ>::iterator it = words_vector.begin(); it != words_vector.end(); ++it) {
        ptr = *it;

        std::string this_word = ptr.word;

        // if so, delete it
        if (std::find(placenames.begin(), placenames.end(), this_word) != placenames.end()) {
            words_vector.erase(it);
        }
    }

    // output how many words remain and the amount of words removed for analysis purposes
    std::cout << "Size after removing place names: " << words_vector.size() << '\n';
    int diff = start - words_vector.size();
    std::cout << "---Removed " << diff << " entries" << '\n' << "==========================================================" << '\n' << '\n';
}
/*
There is a file in this directory called placenames.txt
It contains a list of place names that are 6-letters long. The list was combed by hand to remove place names that are also regular words
Removes instances of many proper nouns from the word list
There are 2652 place names in the placenames list

This one requires each word to be compared to the list of places which takes a long time. Therefore it will be done later when the list is smaller
*/
There is a file in this directory called placenames.txt
It contains a list of place names that are 6-letters long. The list was combed by hand to remove place names that are also regular words
Removes instances of many proper nouns from the word list
There are 2652 place names in the placenames list

This one requires each word to be compared to the list of places which takes a long time. Therefore it will be done later when the list is smaller
There is a file in this directory called placenames . txt It contains a list of place names that are 6 - letters long . The list was combed by hand to remove place names that are also regular words Removes instances of many proper nouns from the word list There are 2652 place names in the placenames list This one requires each word to be compared to the list of places which takes a long time . Therefore it will be done later when the list is smaller
void remove_placenames() {
    word_occ ptr;
    std::cout << "Removing placenames." << '\n';
    std::cout << "Starting list size is: " << words_vector.size() << '\n';
    int start = words_vector.size();
    std::vector<std::string> placenames;
    std::ifstream placenames_list;
    placenames_list.open("placenames.txt");
    std::string line;
    std::string place;
    while (getline(placenames_list, line)) {
        std::istringstream ss(line);
        ss >> place;
        placenames.push_back(place);
    }
    for (std::vector<word_occ>::iterator it = words_vector.begin(); it != words_vector.end(); ++it) {
        ptr = *it;
        std::string this_word = ptr.word;
        if (std::find(placenames.begin(), placenames.end(), this_word) != placenames.end()) {
            words_vector.erase(it);
        }
    }
    std::cout << "Size after removing place names: " << words_vector.size() << '\n';
    int diff = start - words_vector.size();
    std::cout << "---Removed " << diff << " entries" << '\n' << "==========================================================" << '\n' << '\n';
}
void remove_placenames ( ) { word_occ ptr ; std :: cout << " " << ' \n ' ; std :: cout << " " << words_vector . size ( ) << ' \n ' ; int start = words_vector . size ( ) ; std :: vector < std :: string > placenames ; std :: ifstream placenames_list ; placenames_list . open ( " " ) ; std :: string line ; std :: string place ; while ( getline ( placenames_list , line ) ) { std :: istringstream ss ( line ) ; ss >> place ; placenames . push_back ( place ) ; } for ( std :: vector < word_occ > :: iterator it = words_vector . begin ( ) ; it != words_vector . end ( ) ; ++ it ) { ptr = * it ; std :: string this_word = ptr . word ; if ( std :: find ( placenames . begin ( ) , placenames . end ( ) , this_word ) != placenames . end ( ) ) { words_vector . erase ( it ) ; } } std :: cout << " " << words_vector . size ( ) << ' \n ' ; int diff = start - words_vector . size ( ) ; std :: cout << " " << diff << " " << ' \n ' << " " << ' \n ' << ' \n ' ; }
There is a file in this directory called placenames.txt
It contains a list of place names that are 6-letters long.
There is a file in this directory called placenames . txt It contains a list of place names that are 6 - letters long .
// catalogue starting data for analysis purposes
 // create new vector of placenames, this will go out of scope when the function completes
 // for each word in the master list, check if it also exists in the list of placenames
 // if so, delete it
 // output how many words remain and the amount of words removed for analysis purposes
