Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objectives Become Familiar with using strings, lists, dictionaries, and les learn how to sort a list learn how to read data from and write data

image text in transcribedimage text in transcribed
Objectives Become Familiar with using strings, lists, dictionaries, and les learn how to sort a list learn how to read data from and write data to les Write a program in more than one module In preparation for this assignment, read Chapter 11 of the textbook. Assignment Create a List of Distinct Words in a set of Text Documents1 Write a program that opens and reads one or more les containing English text, scans each one to accumulate a list of individual words appearing in that le, and then, when each input le has been scanned, writes to another le the list of unique words appearing in the entire set of input les in assume-a: Wer along with the number of occurrences of each word. Your program must also write the total number of words read {including duplicates). Your program must ignore the cases of words. For example, 'This' and 'this' are the same word. On the other hand, singular and plural words are usually different for example 'ie' and 'les' as are different verb forms such as 'eat' and 'eats.' Hyphenated words must be treated as one word:- for example, 'deep-seated' is different om the words 'deep' and 'seated.' You must also take into account possessives and contractions such as \"don't\" and \"Bob's". Note that \"Bob's\" is a separate word from "Bob\". Numbers such as 10,000 or $50 or 45 should also be treated as words. You may assume that words do not break across lines. A sample output le should be in a format resembling the list shown on the next page. 166 a 25 and 11 as 2 bob 1 bob ' s 15 each 2 file 4 files 109 in 4 input. 98 it. 99 of 3 open 1 open source 6 program 18 read 152 the II 1 thi s 3 under 30 would 20 Humble: of distinct words 790 Total words road To allow for vet},r long input les, the eld width of the number of occurrences of each word should be at least ne decimal digits. The counts need to be nghjul'ted in the output. You print the number of distinct words and the total number of words read. All the words should be in lower case

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Understanding the marketplace and customer needs

Answered: 1 week ago