Write a program (using the output from the previous exercise) to answer questions such as: How many
Question:
Write a program (using the output from the previous exercise) to answer questions such as: “How many occurrences of ship are there in a file?” “Which word occurs most frequently?” “Which is the longest word in the file?” “Which is the shortest?” “List all words starting with s.” “List all four-letter words.”
Data from Previous Exercise
Write a program to “clean up” a text file for use in a word query program; that is, replace punctuation with whitespace, put words into lower case, replace don’t with do not (etc.), and remove plurals (e.g., ships becomes ship). Don’t be too ambitious. For example, it is hard to determine plurals in general, so just remove an s if you find both ship and ships. Use that program on a real-world text file with at least 5000 words (e.g., a research paper).
Step by Step Answer:
Here is an example of how you could write a Python program to answer the questions using the output ...View the full answer
Students also viewed these Computer science questions
-
Provide a GUI for the program from the previous exercise. Data from Previous Exercise Write a program (using the output from the previous exercise) to answer questions such as: How many occurrences...
-
Write a program to clean up a text file for use in a word query program; that is, replace punctuation with whitespace, put words into lower case, replace dont with do not (etc.), and remove plurals...
-
A 23-station transfer line has been logged for 5 days (total time = 2400 min). During this time there were a total of 158 downtime occurrences on the line. The accompanying table identifies the type...
-
Using mean-variance portfolio theory, prove that the efficient frontier becomes a straight line in the presence of a risk-free asset. [3] Consider two independent assets, Asset A and Asset B, with...
-
Describe the components for developing and delivering good ET programs.
-
ThisisaGroupassignment.TeamsoftwotofourstudentsshouldcollaboratetodevelopyourProjectReport....
-
Beyond simply increasing revenue, what advantages might a new business benefit from thanks to early international exposure and growth? L01
-
Kaizer Plastics produces a variety of plastic items for packaging and distribution. One item, container #145, has had a low contribution to profits. Last year, 20,000 units of container #145 were...
-
Please Answer part C!! PR 23-3A Direct materials, Direct Labor and factory overhead cost variance PR 23-3A Direct materials, direct labor, and factory overhead cost variance OBJ. 3, 4 analysis...
-
On July 1, 2020, Academic Learning Services entered its second month of operations. On July 31, 2020, Breanne Allarie, the owner, finalized the company?s records that showed the following items. Use...
-
Is list an associative container? Why not?
-
What is the basic ordering property of binary tree?
-
Indicate whether each of the following statements is true or false by writing T or F in t he a nswer c olumn. A tort is a violation of the rights of a particular person.
-
Question 7 Two objects, of masses 3 and 4 kg, are hung from the ends of a stick that is 70 cm long and has marks every 10 cm, as shown above. If the mass of the stick is negligible, at which of the...
-
Since they do not have enough saved, Rachel and John would like to consider retiring later. Create a new timeline and recalculate all of the relevant values to determine at what age Rachel and John...
-
Problem 6 Find the partial derivative with respect to x for the following functions: (a) p = 56 (b) y(x)=56-4x (c) m = r (d) q= x (e) f(x) =x3 (f) g(x,y) = xy 2 (g) h(x,y) = Ax1/2y1/2, where A is a...
-
Consider the information in the file named Cost Functions of the Firm (also presented above). Please read that file carefully before answering this and the following questions. The fixed cost of...
-
On January 1, 2022, Monica Company acquired 80 percent of Young Company's outstanding common stock for $872,000. The fair value of the noncontrolling interest at the acquisition date was $218,000....
-
How much more money is required to fund an ordinary perpetuity than a 25-year ordinary annuity, if the funds can earn 4% compounded quarterly, and both pay $500 monthly?
-
Is it a breach of fiduciary duty for a director of a real estate investment trust (REIT) negotiating a joint venture on behalf of the REIT with another director for the development of a portfolio of...
-
What is the difference between using a subquery with a CREATE TABLE command and using a subquery with an INSERT command?
-
What is the difference between a view and a materialized view?
-
What is a sequence? Write its syntax.
-
ABC Corporation has an activity - based costing system with three activity cost pools - Machining, Setting Up , and Other. The company's overhead costs, which consist of equipment depreciation and...
-
Consolidated Balance Sheets - USD ( $ ) $ in Thousands Dec. 3 1 , 2 0 2 3 Dec. 3 1 , 2 0 2 2 Current assets: Cash and cash equivalents $ 9 8 , 5 0 0 $ 6 3 , 7 6 9 Restricted cash 2 , 5 3 2 Short -...
-
How does corporate governance contribute to investor confidence and stakeholder trust? Accounting
Study smarter with the SolutionInn App