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.
-
Product mix decision Aramis Aromatics Company produces and sells its product AA100 to well-known cosmetics companies for $940 per ton. The marketing manager is considering the possibility of refining...
-
The following are types of assurance services with the exception of: (a) Training engagement (b) Due diligence engagement (c) Compliance engagement (d) Financial engagement
-
Auditing standards require the auditor to obtain an understanding of the entity and its environment as a basis for assessing the risks of material misstatements. Business models differ across...
-
What specific types of data were collected? Are there other data items you might add? 2. How was the data coded? Is the coding consistent? 3. You need to know which specific factors are most...
-
Recently, Ashland MultiComm Services has been criticized for its inadequate customer service in responding to questions and problems about its telephone, cable television, and Internet services....
-
Is list an associative container? Why not?
-
What is the basic ordering property of binary tree?
-
On May 10, 2010, the Horan Company purchased equipment for $25,000. The equipment has an estimated service life of five years and zero residual value. Assume that straight-line depreciation is used....
-
The radio telescopes at Amherst, Massachusetts, and Onsala, Sweden, are used as an interferometer, the baseline being 2900 km. a) What is the resolution at 22 GHz in the direction of the baseline? b)...
-
How many networks (subnets) are required for the about network diagram? The answer must indicate pairs of network such as A - R1. Network A 50 hosts Network B 60 hosts eth1 R1 eth2 eth1 eth2 R3 eth1...
-
Lab 2 One of the most well-known packet sniffers is called Wireshark (formerly named Ethereal). It is a powerful tool that can capture, filter, and analyze network traffic. It can promiscuously...
-
You are given a string letters made of N English letters. Count the number of different letters that appear in both uppercase and lowercase where all lowercase occurrences of the given letter appear...
-
Bald Bakers sweet challenge Case analysis a)Clearly identify the major strategic issue facing the company. Remember to focus on marketing strategy and not the immediate short-term problems....
-
You are given three ethical dilemma resolution models to try out on a dilemma provided there. Please review that interactive before posting to the threads this week, and let's bring your questions...
-
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.
-
Minimizing bond portfolio duration dispersion is not optimal if: a.Portfolio dispersion exceeds Liability dispersion b.Liability dispersion exceeds Portfolio dispersion c.Liability and Portfolio...
-
Eliminating options that are identified as being incorrect right away is a good strategy. The following are some options that can be eliminated except: Options that mean the same but worded...
-
The strategies that can be used to deal with a risk include preventive, detective, corrective and reactive. True False
Study smarter with the SolutionInn App