Program functions

1. getInput( ): returns string.

This function prompts and gets input from the user.

2. getText(< URL string >): returns string

This function returns the text at https://jhub.analyticus.org/data/a-dog-is-a-dog.txt

3. wordFrequency(< string variable1 >, < string variable2 >): returns int

This function takes as arguments two string variables: a word and the block of text retrieved from the getText function.

This function returns the frequency of occurrences of the word in the text. For example, consider the use of the following text variable:

wordFrequency('dog', text) -> 7

4. replaceInText(< string variable1 >, < string variable2 >, < string variable3 >): returns nothing - prints to screen.

This function takes as arguments three string variables: a target word, a replacement word, and the block of text retrieved from the getText function. This function replaces all instances of the target word with the replacement word in the text and prints the new text to the screen.

5. wordGram(< string variable1 >): returns nothing - creates a chart.

This function produces a histogram of the words in the url's text.

You may first want to convert the url string into a list of words.

Hint: Have the output of wordGram printed in ASCII to the terminal such as:

and ****
cat **
dog *******
town *

Hint: Use a dictionary for the word counter, with each word used as a key and the associated value being the count.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.