Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CPSC 131 Fall 2018 Project 5: Concordance (using sid:multimapT, U, Comparator>), use #nclude The Standard Lbrary provides sets, multisets, maps, and multimaps, which are all

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
CPSC 131 Fall 2018 Project 5: Concordance (using sid:multimapT, U, Comparator>), use #nclude The Standard Lbrary provides sets, multisets, maps, and multimaps, which are all typicaly implemented as balanced binary search trees. Maps and multimaps are associative containers, that associate a key with a value. Multimaps are different from maps in that they allow mutiple values for a given key A concordance is an alphabetical list of the words in a text, with citations of the passages concerned. It is more useful if the words are first sorted by length, then alphabetically. Here is a smaller sample output of the program you will write. (Compare it to your own writing.) MAKING CONCORDANCE with FuE: hpt pagel.txt :2346781 be: 157 he: 27 1 ir:3 in: 12 4 : 3 ar: 12 7910 0:157 p:79 all: 7 and: 1 23 579 1 but: 36 : 236 hs: 79 ars: 1 2347 out: 37 ay: 1 she: 2 4 on: 26 the: 123 567891 Project 5: page 1 of 4 The numbers next to each word indicate the line numbers at which the word was found Objective You are given a partial implementation of a concordance class. It contains the class declaration, the minimum and maximum length of words to analyze (e.g, from 4 letter words to 12 letter words), a multimap (std multimapestdstring, size 1, StringLenCmpp), and a vector (std:vectorsize ). The StringLenCmp class is provided. The vector counts how many unique words of each length occurred (it doesn't count the number of times that word occurred). The Comparator class only defines operator), sometimes called the function call operator. As you can see from the code, its only job is to tel the mutimap to sort the entries frst by word length, then aphabetically. Nothing to it Your job is to complete the concordance class (concordance h), so that it correctly calculates the number of words in three separate pieces of text, all from the book: Harry Potter and the Sorceror's Stone. The first piece of text is the first paragraph from the book. The second piece is the first page (and a bit more to finish the paragraph). The last piece is the entire first chapter from the book Source Code Files You are given "skeleton code files with declarations that may be incomplete and without any implementation. Implement the code and ensure that all the tests in main.cpp pass succes sfully e concordance.h: This is to be completed Note: the functions to read from a file and spit a line into words is already given to you. You need to implement the remaining 4 public member functions. main.cpp: This calls a test function (in main.cpp) that tests the output of your concordance class. You may wish to add additional tests, bas ed on the ones already provided README.md: You must edit this fle to include the name and CSUF email of each student in your group. Do this even if you are working by yoursef. This information will be used so that we can enter your grades into Titanium. Hints As you start implementing the concordance class, comment out the tests in main.cpp that you haven't implemented yet in your class. As you fil in the code for your class, uncomment the matching tests to make sure your class is working. Keep testing your code as you mplement it. is much easier to debug one method in your class than al of the methods at the same time. Do not wait till the very end to test your code. Speak to your teachers if you need help designing your approach, or are having trouble compiling or debugging your code. const errors can frequently prevent your code from compiling. Note also that it is possble to be 95% of the way finished, but have the impression you are miles away. Your instructor can help you get over that final 5% if you need help. Don't hesitate to ask. Expected output There are two types of output: 1) the counts of words of each length and 2) the list of words sorted by length along with their page numbers Project 5 page 2 of 4 Word counts When you complete your project, all of the tests of word counts should run correctly. Expected output is shown below, for the concordance of all three input files hp1 paragraph words with length... PASSED para words with length 1: expected and received PASSED..para words with length 2: expected and received 6 PASSED. .para words with length 3: expected and received 5 PASSED. .para words with length 4: expected and received 11 PASSED. -para words with length 5: expected and received 4 PASSED..para words with length 6: expected and received 6 PASSED. para words with length 7: expected and received 3 PASSED..para words with length 8: expected and received 3 PASSED...para words with length9: expected and received 1 PASSED. .para words with length 18: expected and received 1 PASSED hp1.para total words: expected and received 40 hp1 page words with length PASSED...page words with length expected and received 1 PASSED. .page words with length 2: expected and received 15 PASSED. .page words with length 3: expected and received 3 PASSED. .page words with length 4: expected and received 48 PASSED. -page words with length 5: expected and received 38 PASSED..page words with length 6: expected and received 40 PASSED page words wdth length 7: expected and received 29 PASSED. .page words with length 8: expected and received 17 PASSED..page words with length 9: expected and received 9 PASSED. .page words with length 10: expected and received 2 PASSED page words with length 11: expected and received PASSED..page words with length 12: expected and received 1 PASSED.. .page words with length 13: expected and received 8 PASSED. .page words with length 14: expected and received e PASSED.page words with length 15: expected and received PASSED hp1 page1 total words: expected and received 213 hp1 chapter words with length PASSED..chapter words with length 1: expected and received 3 PASSED...chapter words with length 2: expected and received 28 PASSED. .chapter words with length 3: expected and received 96 PASSED. .chapter words with length 4: expected and received 222 PASSED. .chapter words with length 5: expected and received 205 PASSED..chapter words with length 6: expected and received 287 PASSED..chapter words with length 7: expected and received 184 PASSED...chapter words with length 8: expected and received 122 PASSED. .chapter words with length9: expected and received 62 Project 5: Concordance page 3 of4 PASSED. .chapter words with length 18: expected and received 26 PASSED. chapter words with length 11: expected and received 12 PASSED. .chapter words with length 12: expected and received 7 PASSED .. .chapter words with length 13: expected and received 3 PASSED. .chapter words with length 14: expected and received 1 PASSED. .chapter words with length 15: expected and received 8 PASSED hp1 chapter1 total words: expected and received 1179 PASSED Total tests passed: expected and received 43 done Printing the concordance In addition to the automated tests of word counts, you are also expected to print the list of words and page numbers by iterating through the multimap. The challenge is to print only once and not to repeat page numbers. Sample output is shown in this file. Obtaining and submitting code Click the assignment link to fork your own copy of the skeleton code to your PC Development environment The test platform is Linux with the g+ -std c+ +14 compler. For this reason, the recommended development platform is Linux. Linux environment To attempt to compile the test program, use the following command: clang** -g -std +14 main.cpp -o test To attempt to run the compiled test program, use the following command /test Grading rubric Your grade will be comprised of two parts, Form and Function. Function refers to whether your code works properly as tested by the main function (80%). Form refers to the design, organization and presentation of your code. An instructor will read your code and evaluate these aspects of your submission (20%). Deadline The project deadline is November 28th 30th at 11:55pm Project 5 page 4 of 4 CPSC 131 Fall 2018 Project 5: Concordance (using sid:multimapT, U, Comparator>), use #nclude The Standard Lbrary provides sets, multisets, maps, and multimaps, which are all typicaly implemented as balanced binary search trees. Maps and multimaps are associative containers, that associate a key with a value. Multimaps are different from maps in that they allow mutiple values for a given key A concordance is an alphabetical list of the words in a text, with citations of the passages concerned. It is more useful if the words are first sorted by length, then alphabetically. Here is a smaller sample output of the program you will write. (Compare it to your own writing.) MAKING CONCORDANCE with FuE: hpt pagel.txt :2346781 be: 157 he: 27 1 ir:3 in: 12 4 : 3 ar: 12 7910 0:157 p:79 all: 7 and: 1 23 579 1 but: 36 : 236 hs: 79 ars: 1 2347 out: 37 ay: 1 she: 2 4 on: 26 the: 123 567891 Project 5: page 1 of 4 The numbers next to each word indicate the line numbers at which the word was found Objective You are given a partial implementation of a concordance class. It contains the class declaration, the minimum and maximum length of words to analyze (e.g, from 4 letter words to 12 letter words), a multimap (std multimapestdstring, size 1, StringLenCmpp), and a vector (std:vectorsize ). The StringLenCmp class is provided. The vector counts how many unique words of each length occurred (it doesn't count the number of times that word occurred). The Comparator class only defines operator), sometimes called the function call operator. As you can see from the code, its only job is to tel the mutimap to sort the entries frst by word length, then aphabetically. Nothing to it Your job is to complete the concordance class (concordance h), so that it correctly calculates the number of words in three separate pieces of text, all from the book: Harry Potter and the Sorceror's Stone. The first piece of text is the first paragraph from the book. The second piece is the first page (and a bit more to finish the paragraph). The last piece is the entire first chapter from the book Source Code Files You are given "skeleton code files with declarations that may be incomplete and without any implementation. Implement the code and ensure that all the tests in main.cpp pass succes sfully e concordance.h: This is to be completed Note: the functions to read from a file and spit a line into words is already given to you. You need to implement the remaining 4 public member functions. main.cpp: This calls a test function (in main.cpp) that tests the output of your concordance class. You may wish to add additional tests, bas ed on the ones already provided README.md: You must edit this fle to include the name and CSUF email of each student in your group. Do this even if you are working by yoursef. This information will be used so that we can enter your grades into Titanium. Hints As you start implementing the concordance class, comment out the tests in main.cpp that you haven't implemented yet in your class. As you fil in the code for your class, uncomment the matching tests to make sure your class is working. Keep testing your code as you mplement it. is much easier to debug one method in your class than al of the methods at the same time. Do not wait till the very end to test your code. Speak to your teachers if you need help designing your approach, or are having trouble compiling or debugging your code. const errors can frequently prevent your code from compiling. Note also that it is possble to be 95% of the way finished, but have the impression you are miles away. Your instructor can help you get over that final 5% if you need help. Don't hesitate to ask. Expected output There are two types of output: 1) the counts of words of each length and 2) the list of words sorted by length along with their page numbers Project 5 page 2 of 4 Word counts When you complete your project, all of the tests of word counts should run correctly. Expected output is shown below, for the concordance of all three input files hp1 paragraph words with length... PASSED para words with length 1: expected and received PASSED..para words with length 2: expected and received 6 PASSED. .para words with length 3: expected and received 5 PASSED. .para words with length 4: expected and received 11 PASSED. -para words with length 5: expected and received 4 PASSED..para words with length 6: expected and received 6 PASSED. para words with length 7: expected and received 3 PASSED..para words with length 8: expected and received 3 PASSED...para words with length9: expected and received 1 PASSED. .para words with length 18: expected and received 1 PASSED hp1.para total words: expected and received 40 hp1 page words with length PASSED...page words with length expected and received 1 PASSED. .page words with length 2: expected and received 15 PASSED. .page words with length 3: expected and received 3 PASSED. .page words with length 4: expected and received 48 PASSED. -page words with length 5: expected and received 38 PASSED..page words with length 6: expected and received 40 PASSED page words wdth length 7: expected and received 29 PASSED. .page words with length 8: expected and received 17 PASSED..page words with length 9: expected and received 9 PASSED. .page words with length 10: expected and received 2 PASSED page words with length 11: expected and received PASSED..page words with length 12: expected and received 1 PASSED.. .page words with length 13: expected and received 8 PASSED. .page words with length 14: expected and received e PASSED.page words with length 15: expected and received PASSED hp1 page1 total words: expected and received 213 hp1 chapter words with length PASSED..chapter words with length 1: expected and received 3 PASSED...chapter words with length 2: expected and received 28 PASSED. .chapter words with length 3: expected and received 96 PASSED. .chapter words with length 4: expected and received 222 PASSED. .chapter words with length 5: expected and received 205 PASSED..chapter words with length 6: expected and received 287 PASSED..chapter words with length 7: expected and received 184 PASSED...chapter words with length 8: expected and received 122 PASSED. .chapter words with length9: expected and received 62 Project 5: Concordance page 3 of4 PASSED. .chapter words with length 18: expected and received 26 PASSED. chapter words with length 11: expected and received 12 PASSED. .chapter words with length 12: expected and received 7 PASSED .. .chapter words with length 13: expected and received 3 PASSED. .chapter words with length 14: expected and received 1 PASSED. .chapter words with length 15: expected and received 8 PASSED hp1 chapter1 total words: expected and received 1179 PASSED Total tests passed: expected and received 43 done Printing the concordance In addition to the automated tests of word counts, you are also expected to print the list of words and page numbers by iterating through the multimap. The challenge is to print only once and not to repeat page numbers. Sample output is shown in this file. Obtaining and submitting code Click the assignment link to fork your own copy of the skeleton code to your PC Development environment The test platform is Linux with the g+ -std c+ +14 compler. For this reason, the recommended development platform is Linux. Linux environment To attempt to compile the test program, use the following command: clang** -g -std +14 main.cpp -o test To attempt to run the compiled test program, use the following command /test Grading rubric Your grade will be comprised of two parts, Form and Function. Function refers to whether your code works properly as tested by the main function (80%). Form refers to the design, organization and presentation of your code. An instructor will read your code and evaluate these aspects of your submission (20%). Deadline The project deadline is November 28th 30th at 11:55pm Project 5 page 4 of 4

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

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

Define the different types of unemployment

Answered: 1 week ago