Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 ( 2 0 points ) In one of the labs, we wrote a function that given input from ` cin ` , output

Question 1(20 points)
In one of the labs, we wrote a function that given input from `cin`, output a frequency table of the number of times each word in the input was repeated. There was one problem: we needed a way to deal with mixed case and punctuation characters. Let's deal with that problem: write a function that when given a reference to a `string` as an argument, returns a reference to a new string will characters converted to lower case and all punctuation marks removed (use the usual culprits here with removing `,.?!`, remembering "You ain't going to need it, and if you do, someone else has done it for").
Question 2(20 points)
Write a function that given an input stream as an example returns a reference to a list of words read from the stream in the order they were entered, with two small additions: put two empty strings at the front of the list and two empty strings at the end of the list.
Question 3(50 points)
KWIC is an acronym for "Key Word In Context". This is the most common format for concordance indexes in documents. It is also the starting point for most spelling and grammar checkers in word processors. You will use the classes in the C++ Standard Library to write a program that creates such an index for text read from the standard input
Do this by processing the list created by the function from Question 2 to create a C++`map>` where the key is a string containing the word found and the value is a list of strings showing how the word was used each time it was found in the text.
How to do this? Create a queue and put the first five items from your list in the queue. The third string in the queue is the word to be put into the map and the five items in the queue need to be put into a string and then added to the list of values for this word. Then pop the front of the queue and push the next item in the list into the queue. Keep doing this until you hit the last item in the list (you'll need to think about to use iterators to help you do this).

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

More Books

Students also viewed these Databases questions

Question

Communicate ethically.

Answered: 1 week ago