Question
Example: Your program takes four command-line arguments: the number of most common words to print out, the name of the text file to process, the
Example: Your program takes four command-line arguments: the number of most common words to print out, the name of the text file to process, the stop word list file, and the size of your hash table. Running your program using: ./a.out 10 HW7-HungerGames_edit.txt HW7-stopWords.txt 53 would return the 10 most common words in the file HW7-HungerGames_edit.txt, use a hash table of size 53, and should produce the following results:
682 - is 492 - peeta 479 - its 431 - im 427 - can
414 - says 379 - him 368 - when 367 - no 356 - are # Number of collisions: 7628 # Unique non-stop words: 7681 # Total non-stop words: 59045 Program Specifications The following are requirements for your program: Your Hash Table must be implemented in a class based on the provided HashTable.hpp. You must implement a driver program that utilizes your HashTable class. This driver program will contain your main function. When executing your driver program: o read in the number of most common words to process from the first command-line argument.
o Read in the name of the text file to process from the second command- line argument.
o Read stopwords from the file specified by the third command-line argument. o Create a hash table of size specified by the fourth command-line argument.
Write a member function named getStopwords that takes the name of the stopwords file, fills the data member vector vecIgnoreWords with the stopwords, and returns void. Read in the file for a list of the top 50 most common words to ignore (e.g., Table 1). o The file will have one word per line, and always have exactly 50 words in the file. We will test with files having different words in it! o Your function will update the vector with a list of the words from the file. o You can use your getStopWords function from Homework 2 as a starting point!
HW2 getStopWords function
void getStopWords (char *ignoreWordFileName, vector
if (inFile.is_open()){ while(inFile >> data){ _vecIgnoreWords.push_back(data); }
inFile.close(); } else{ cout << "Stop Words File not opened! Try again!"; } return; }
Copy your HashTable::getStopWords() method into the box below, with the provided prototype. You may use any helper functions as needed, but they must be copied into the answer box. You may assume that ALL other class methods are defined and available for you to call. Your answer should look like:
void HashTable::getStopWords(char *ignoreWordFileName) { // Your code here }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started