139k views
0 votes
Write a function in the cell below that iterates through the words in file_contents, removes punctuation, and counts the frequency of each word. Oh, and be sure to make it ignore word case, words that do not contain all alphabets and boring words like "and" or "the". Then use it in the generate_from_frequencies function to generate your very own word cloud!

1 Answer

7 votes

Answer:

Step-by-step explanation:

The diagrams attached to the questions are shown in the first and the second image below. The first image shows the code and the second image shows the error that appears at the moment of running it.

To answer that ; We will notice that the error in the second image is what it says; what happened is that the individual subject performing this action is trying to to open the file called "h.txt", but the python interpreter is unable to find the file. The individual subject will need to have h.txt inside your current working directory for python to open it.

From the third image attached ; I have careful attached an image that illustrate how you can add the file by going to file → open (right from your jupyter notebook). Afterwards you can either upload the file, or create a new text file and paste the contents on it as displayed in the fourth image attached in the diagram below.

Write a function in the cell below that iterates through the words in file_contents-example-1
Write a function in the cell below that iterates through the words in file_contents-example-2
Write a function in the cell below that iterates through the words in file_contents-example-3
Write a function in the cell below that iterates through the words in file_contents-example-4
User Will Madden
by
4.3k points