Question: Use python In this problem you will use the file 100-0.txt which is the complete works of Shakespeare. Carry out the steps below. By word
Use python
In this problem you will use the file 100-0.txt which is the complete works of Shakespeare. Carry out the steps below. By word we will refer to the elements of a list that is produced by splitting the string containing the contents of the file on whitespace. You will need to remove punctuation and convert all words to lowercase. Store your answers in the appropriate variables.
the txt file start like this:
_______________________________________________________________________________________________________
The Project Gutenberg eBook of The Complete Works of William Shakespeare, by William Shakespeare This eBook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at www.gutenberg.org. If you are not located in the United States, you will have to check the laws of the country where you are located before using this eBook. Title: The Complete Works of William Shakespeare Author: William Shakespeare Release Date: January 1994 [eBook #100] [Most recently updated: August 16, 2021] Language: English Character set encoding: UTF-8 *** START OF THE PROJECT GUTENBERG EBOOK THE COMPLETE WORKS OF WILLIAM SHAKESPEARE *** The Complete Works of William Shakespeare by William Shakespeare Contents THE SONNETS ALLS WELL
_____________________________________________________________________________________________________________
(a) Determine the ten words which occur the most number of times in the text file. Store these in a list sorted according to frequency. (
b) Create a dictionary which contains the frequencies for the bigrams in the text file. A bigram is a pair of words which occur one after the other. Bigrams should occur within a sentence so you may need to first create a list of sentences. You can assume that splitting on . will accomplish this although that is unlikely to be the case as . can appear in different contexts.
Please note I gave the you the txt file above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
