Question: Declare a struct TokenFreq that consists of two data members: (1) string value ; and (2) int freq; Obviously, an object of this struct will
Declare a struct TokenFreq that consists of two data members: (1) string value; and (2) int freq; Obviously, an object of this struct will be used to store a specific token and its frequency. For example, the following object word stores the token "dream" and its frequency 100:
TokenFreq word;
word.value="dream";
word.freq=100;
Implement the function vector getTokenFreq( string inFile_name); This function reads the specified input file line by line, identifies all the unique tokens in the file and the frequency of each token. It stores all the identified (token, freq) pairs in a vector and returns this vector to the calling function. (case insensitive)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
