Question
This assignment is a warm-up exercise that will give you experience using the autograder and writing a simple C++ program using the Standard Template Library
This assignment is a warm-up exercise that will give you experience using the autograder and writing a simple C++ program using the Standard Template Library (STL). For this assignment, you will write a program in C++ that generates an "inverted index"of all the words in a list of text files. See Wikipedia for more details regarding inverted indexes. The goal of this assignment is to ensure that you are sufficiently Inverter Input Your inverter will take exactly one argument: a file that contains a list of filenames. Each filename will appear on a separate line. Each of the files described in the first file will contain text from which you will build your index. For example: inputs.txt ----- foo1.txt foo2.txt foo1.txt ----- this is a test. cool. foo2.txt ----- this is also a test. boring. Inverter Output Your inverter should print all of the words from all of the inputs, in "alphabetical" order, followed by the document numbers in which they appear, in order. For example (note: your program must produce exactly this output): a: 0 1 also: 1 boring: 1 cool: 0 is: 0 1 test: 0 1 this: 0 1 Alphabetical is defined as the order according to ASCII. So "The" and "the" are separate words, and "The" comes first. Only certain words should be indexed. Words are anything that is made up of only alpha characters, and not numbers, spaces, etc. "Th3e" is two words, "Th" and "e". Files are incrementally numbered, starting with 0. Only valid, "open-able" files should be included in the count. (is_open() comes in handy here.) Your program should absolutely not produce any other output. Extraneous output, or output formatted incorrectly (extra spaces, etc.) will make the autograder mark your solution as incorrect. In particular, the output should have one space between the colon and the first document number, one space between each subsequent document number, and no spaces at the end of any line. Please leave yourself extra days to work these problems out. Implementation Hints Implement the data structure using the C++ Standard Template Library (STL) as a map of sets, as in: map
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