Question: Using Java, you are to implement a TextAnalyzer class that count the frequency of words in a paragraph of text. Internally, the TextAnalyzer will use

Using Java, you are to implement a TextAnalyzer class that count the frequency of words in a paragraph of text. Internally, the TextAnalyzer will use a Tokenizer, HashMap and Priority Queue for implementation of its functionality.

1. The TextAnalyzer class provides a constructor that takes in a file name and reads the text from that file. The constructor will read the text from the file and tokenizes it.

2. The class uses a HashMap to count the frequency of each word encountered (note that each word is treated as unique regardless of the underlying stem that is run, runs, and running are all treated as unique words).

3. The use a PriorityQueue to sort the words either by the frequency of word occurrence or by the lexicographic ordering of the words.

4. Two functions FreqSort() and LexiSort() respectively print out the word frequencies sorted by the frequency of word occurrence, and by the lexicographic order.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!