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.
-
Identify the target cells and effects of estrogen, progesterone, and testosterone.
-
Determine whether each experiment is a binomial experiment. If it is, specify the values of n, p, and q, and list the possible values of the random variable x. If it is not, explain why. 1. A certain...
-
An investor purchased a one-acre lot on the outskirts of a city for $9000 cash. Each year he paid $80 of property taxes. At the end of 4 years, he sold the lot. After deducting his selling expenses,...
-
Find the derivative of the function *4-7x3+ x F(x)= in two ways: by using the Quotient Rule and by simplifying first. (Check that your answers are equivalent. Which method do you prefer?). Quotient...
-
You are evaluating various investment opportunities currently available and you have calculated expected returns and standard deviations for five different well-diversified portfolios of risky...
-
Is list an associative container? Why not?
-
What is the basic ordering property of binary tree?
-
Use a graphing calculator to find the range of the given functions. Use the maximum or minimum feature when needed. y 4 x2 x - 4
-
Which modules are on the module path? A. Automatic only B. Named only C. Unnamed only D. Automatic and named E. Automatic and unnamed F. Named and unnamed.
-
Using the diagram in the previous question, which boxes represent the consumer and service locator, respectively? A. W and X B. W and Z C. X and Y D. X and Z E. Y and Z F. None of the above. W Y X Z
-
Ken starts trading on 1 October 2015 and chooses 30 April as his accounting date. He ceases trading on 31 January 2021 and has adjusted trading profits as follows: Compute Ken's trading income for...
-
Which statements about using a parallel stream instead of a serial stream are correct? (Choose three.) A. The number of threads used is guaranteed to be higher. B. It requires a stateful lambda...
-
What does this code output? A. baby B. chick C. cygnet D. duckling E. The code does not compile. var babies = Arrays.asList("chick", "cygnet", "duckling"); "baby"; babies.replaceAll(x -> { var...
-
You're trying to save to buy a new $150,000 Ferrari. You have $35,000 today that can be invested at your bank. The bank pays 3.2 percent annual interest on its accounts. How long will it be before...
-
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.
-
Subtract and simplify: 5x-6x+2-(-2-x+2x)
-
In order to value a company, you would need to forecast its future (a key word here) free cash flows. How would you approach this task? Using downloaded real data, try to make the forecast and see,...
-
share five (5) pieces of advice you would give the class about personal financial planning. Explain each. You might go back and look at the introductions in the first discussion for a general,...
Study smarter with the SolutionInn App