Reference no: EM132212270
Question :
You have to write a Python program (3.5) which take two text files. Start with the "wordfreq.py" script . As presented, it only calculates the frequency of each individual word in a text file, stored in a dictionary structure. Keep the input question that asks how many results you want displayed (n).
Note: Since you'll be doing many of the same operations twice, you should revise the code to write some sensibly-designed reusable functions instead of simply duplicating each chunk of code and changing variable names.
Revise and enhance the program so that the program ALSO does these things:
1. Ask the user for a second text file to compare with the first one. I'll refer to the files "A" and "B" below.
2. Calculate the word frequency for text "B" in the same way it does for "A".
3. For both files, compute and print out how many total words it contains and how many distinct words they contain.
4. For both files, print out the n most frequent individual words (sorted like the provided example already does), but also showing the percentage of the total words each represents in its file. This is simple to calculate, as: frequency_of_word / total_words * 100. Round that to 2 decimal places.
5. Last, as a simple comparison of the texts, your program should print all the words that occured more than once in text "A" but not at all in "B" and vice-versa.
What you have learned in your graduate degree program
: Assess your preparedness for a business leadership and management position based on what you have learned in your graduate degree program.
|
Define differences between carrying amounts and fair values
: Goodwill was not impaired in any period. The plant and equipment had a further 5-year life at acquisition date and was expected to be used evenly over that time
|
Calculate a students average for a semester
: How to write this in pseudocode and create flowchart: For this program, you will calculate a student's average for a semester.
|
Prepare a fully classified income statement
: ACCT 1008 Accounting for Business Assignment, University of South Australia, Australia. Prepare a fully classified Income Statement
|
Calculate the word frequency for text b in the same way
: For both files, compute and print out how many total words it contains and how many distinct words they contain.
|
Perform insertion on a doubly-linked list
: Write a pseudocode to perform insertion on a doubly-linked list.
|
A python program that plays a modified yahtzee game
: Write a Python 3.5 program that plays a modified Yahtzee game. You will allow a single player to play with 5 dice.
|
Which of the given is the correct equity method entry
: Investor owns 40% of Investee and applies the equity method. In 2016, Investor sells merchandise costing $210,000 to Investee for $280,000.
|
Calculate the sum of consecutive integers from the lowest
: Write pseudocode to calculate the SUM of consecutive integers from the lowest, L, through the highest, H, but without exceeding 100.
|