Question: For my intro to coding with python class. I provided the original code that the professor started. The question is asking to finish the code.
For my intro to coding with python class. I provided the original code that the professor started. The question is asking to finish the code. Please help! Thank you


4. For this problem, you wi write a program to display a plot of the most frequently occurring words in an input file. You should start with the file named HW5-4.py. Your program should take 3 command line arguments. The first two are required, while the last one is optional: --input: the name of a text file containing the words that should be counted --output: the name of the file where the plot will be saved --top: the number of words whose counts should be included in the plot. The default value for this argument is 10. You can add defaul 10 to the add argument call that sets this up this command line argument. You can also add type int in that add argument call to have argparse automatically convert the value given by the user to an integer. CSCI 195 ntro to Programming w/Python Homework #5 You should use the nltk word tokenize function to break the file up into words. Capitalization of words should not be significant: the strings State and state should be treated as the same word, for example. The punctuation symbols comma, period, colon, and semi-colon should not be counted as words. Given a dictionary named counts, the following statement can be used to get back a list of tuples representing the key,value pairs in counts in descending order by value-this will help you in including the correct number of words in the plot: sorted by value sorted (counts tems key lambda (k, v) -v) Tuples are a lot like lists; you can get more information in section 5.2 of the textbook 4. For this problem, you wi write a program to display a plot of the most frequently occurring words in an input file. You should start with the file named HW5-4.py. Your program should take 3 command line arguments. The first two are required, while the last one is optional: --input: the name of a text file containing the words that should be counted --output: the name of the file where the plot will be saved --top: the number of words whose counts should be included in the plot. The default value for this argument is 10. You can add defaul 10 to the add argument call that sets this up this command line argument. You can also add type int in that add argument call to have argparse automatically convert the value given by the user to an integer. CSCI 195 ntro to Programming w/Python Homework #5 You should use the nltk word tokenize function to break the file up into words. Capitalization of words should not be significant: the strings State and state should be treated as the same word, for example. The punctuation symbols comma, period, colon, and semi-colon should not be counted as words. Given a dictionary named counts, the following statement can be used to get back a list of tuples representing the key,value pairs in counts in descending order by value-this will help you in including the correct number of words in the plot: sorted by value sorted (counts tems key lambda (k, v) -v) Tuples are a lot like lists; you can get more information in section 5.2 of the textbook
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
