how much wood would a woodchuck chuck if a woodchuck could chuck wood
Question 6
Write a python program that accepts a text file as input. The program should read the text file and display all unique words in alphabetical order. It should then display the non-unique words and the number of times that they occurred in the input text.
Input file contains the following text:
how much wood would a woodchuck chuck if a woodchuck could chuck wood
Expected outcome should resemble:
Non-unique words and number of occurrences in no particular order:
wood : 2
a : 2
woodchuck : 2
chuck : 2
Unique words in alphabetic order:
could
how
if
much
would
Hint
Management import re,string# dictionary for frequencyfrequency={}#reading textdocument=open('test.txt', 'r')text= document.read().lower()# finding words using search pattern recursivelypattern= re.findall(r'\b[a-z]{1,15}\b', text) for word in pattern: count = frequency.get(word,0) frequency[word]=count + 1...