logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Zuber KhanEconomics
(5/5)

575 Answers

Hire Me
expert
Jaydon KeySocial sciences
(5/5)

733 Answers

Hire Me
expert
Santosh NayarLaw
(5/5)

947 Answers

Hire Me
expert
Rory BremnerComputer science
(5/5)

549 Answers

Hire Me
Others
(5/5)

count the number of each word in the document and store the word and its count in a dictionary, with the word as the Key and the count as the Value.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Lab Assignment Prompt:  News Editor-in-Chief 

 

As the news editor, who also happens to have some Python skills, your role requires a weekly review of your reporters’ work and make sure it communicates clearly to your audience.  Some of this work is repetitive - especially finding those words and phrases that authors tend to frequently reuse.  

 

To save yourself some time, and improve complete the weekly review faster, you will create a python program to:

Inspect a text document provided by any author/reporter. 

Count the number of times each word appears in the text.  (Common articles, such as a, an, the, may be ignored)  

Search for a specific word and replace it with something different. 

Open a file, operate upon, and save a new version of, a text file stored locally on your computer.

 

NOTE:  Run ALL of the code you created and make sure it works as intended (WAI).

 

Program Requirements:

 

Import a document

Count the number of total words in the document.

Unit 1: Numeric operations

Unit 2: Variables

Count the number of each word in the document and store the word and its count in a dictionary, with the word as the Key and the count as the Value.

Unit 6: Dictionaries

Unit 5: Loops

Unit 2: Assignments and shortcut operators 

Unit 2: Variables

Unit 1: Numeric operations

NOTE: this requirement is basically the dictionary counting trick.

 

Assignment continues on the following page.

 

 

Include a way to exclude common but unimportant words, such as “a”, “an”, “the”.  The user of your code can input a list of these unimportant words and there can be as many as the user would like to ignore.

Unit 4: Lists

Unit 3: Functions (optional parameters)

Unit 5: Loops

Unit 6: Dictionaries, Keys, looping through keys using list elements

Store a second dictionary with each word’s proportion as a float with four decimals, of the text’s total words.  For example, if the word, “weather” is found 143 times out of 5390 total words, the proportion will be calculated as 143 / 5390, and the value will be 0.0265.

Unit 6: Dictionaries

Unit 5: Loops

Unit 2: Assignments

Unit 2: Variables

Unit 1: Numeric operations

NOTE: this requirement is basically a twist on the dictionary counting trick, so students can’t just copy the counting trick.  But they can get close to this.

Accept a user’s query of whether a word exists in the text.  If the word search finds a word, state the word, the number of times it appears, and the proportion of total words made up by that word.  If the word does not find the word, return some information that the word was not found in the text. 

Unit 6: Dictionaries – using Key In / Not In

Unit 4: Lists – using In / Not In

Unit 6: Dictionaries – basic call of a K/V pair

Unit 2: Conditional Statements

Accept a user’s request to list the top n words in the text.  (The user chooses how many.)  The code will print the word, the absolute count, and the proportion of those words - each on its own line.

Unit 6: Dictionaries

Unit 4: Lists (possibly, to extract the list of keys from a dictionary and slice the top n)

Unit 2: Conditional Statements

 

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme