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.
-
Describe how high-grade preferred stocks are priced in the market. What role does dividend yield play in the valuation of preferred stocks? Could you use the zero-growth dividend valuation model to...
-
If the magnitude of the magnetic field in Figure P29.40 changes with time as \(B=B_{\max } \sin (\omega t)\), calculate the magnitude of the electric field that accompanies this changing magnetic...
-
Kirkland conveyed a farm to Adland to have and to hold for and during his life and upon his death to Rubin. Some years thereafter, oil was discovered in the vicinity. Adland thereupon made an oil and...
-
17. Moment of inertia (M.I) of four bodies, having same mass and radius, and reported as: I1 = M.I. of thin circular ring about its diameter 18. 12 = M.I. of circular disc about an axis perpendicular...
-
Which of the graphs in Fig. Q25.12 best illustrates the current I in a real resistor as a function of the potential difference V across it? Explain. Figure Q25.12 (a) (b) (c) (d)
-
Is list an associative container? Why not?
-
What is the basic ordering property of binary tree?
-
It is frequently suggested that items that will become potential problems later in the project life be decided up front, such as how to allocate revenues or dispose of project assets. How can this...
-
The US federal income tax is officially progressive, but why do wealthy people often pay far less than the top tax rate?
-
Sarah is comparing the prices of different laptops before deciding which one to buy. She creates a spreadsheet to record the prices and specifications of each laptop. How is money acting as a unit of...
-
Elon Inc. is a solar battery manufacturer. It would like to lease a specialized equipment to make the production of its batteries more efficient. Elon Inc. can lease the equipment for the term equal...
-
How do digital technologies and virtual reality platforms expand the possibilities of performance art, and what are the challenges they pose to traditional theatrical conventions?
-
You are reading a Journal that was generated by accounting software, what information should you expect to find for each transaction?
-
When a company produces custom products to the specifications of its customers, why should it not aggregate costs across customer orders to determine the prices to be charged?
-
QUESTION 2 The CEO of Farisha Hijab Sdn Bhd insisted on further investigation to be carried out that he also required Mr Muaz to conduct the analysis of variance for the material and labour of the...
-
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.
-
On August 1, 2015, Lifters, a gym, sells 5 annual memberships for $1,500 each. What would the entry look like to record the receipt of cash as deferred revenue?
-
Lyme Incorporated issues 3,000 shares of no-par-value common stock for $20 per share. What is the correct journal entry for this transaction?
-
Unsubstantiated Expenses Your client, Randy Ross, owns a business that sells hinges, brackets, and fuses used in the manufacturing of machinery. Randy spends a large amount of time traveling to...
Study smarter with the SolutionInn App