Question: The code here reads in a file and converts it to a list of words. It strips out all punctuation for you. I want you
| The code here reads in a file and converts it to a list of words. It strips out all punctuation for you. I want you to construct a frequency table for the words, and then print out the 100 most frequent words. Use a dictionary, a.k.a. java.util.Map. You can use TreeMap or HashMap, or if you want, try them both to see if one is faster. If you like, compare your result to the list of the 100 most common words (Links to an external site.).
Here is original program we are given:
|
package lab.pkg7;
import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner;
public class Lab7 {
/** * @param args the command line arguments */ public static void main(String[] args) { { ArrayList
The input file is:
The Project Gutenberg EBook of The Wonderful Wizard of Oz, by L. Frank Baum
However, any input will work for this. Thanks.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
