Question: Please implement this function in C++ 2. identify unique word-pairs and calculate their frequencies. bool wordpairMapping ( vector &sentences, map, int> &wordpairFreq map) Given a

Please implement this function in C++Please implement this function in C++ 2. identify unique word-pairs and calculate

2. identify unique word-pairs and calculate their frequencies. bool wordpairMapping ( vector&sentences, map, int> &wordpairFreq map) Given a list of sentences stored in the first argument sentences, this function identifies all the all the unique word-pairs and each word- pair's frequency. The identified (word-pair, frequency s will be stored into wordpar?Freq map, which is a map of (key, value) pairs. The key of this map a word-pair and the value is the frequency of this word-pair. This function will return true if the mapping is successful false otherwise Note that Tokens are case insensitive. We will consider lower case in this project. Whitespaces will be the token delimiter. The two words in a word-pair are different. For example, event though the first sentence above contains two the, you are not going to construct a word pair Order does not matter between two words in a word-pair. For example, the word-pair is the same as . You are recommended to arrange the two words in lexicographical order before inserting the pair into the map. Suggestions .Use istringstream to tokenize a sentence .Use set to store all the unique tokens identified in a sentence Assume sentences consists of the following 3 sentences: The first story is about connecting the dots The first story is about connecting the dots. The first story is about connecting the dots. This function is going to identify a total of 21 word-pairs as follows

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!