Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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++image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

Students also viewed these Databases questions