Question: Hi, I need the code to be written in JAVA please. Develop a TextAnalyzer class that implements the ITextAnalyzer interface. See ITextAnalyzer.java posted below. You
Hi, I need the code to be written in JAVA please.
Develop a TextAnalyzer class that implements the ITextAnalyzer interface. See ITextAnalyzer.java posted below. You will also need to develop a WordData class that implements the IWordData interface . See IWordData.java posted below. The TextAnalyzer class can be configured to use either a java.util.HashMap class or a java.util.TreeMap class to store the unique words and the associated frequency counts. A constructor parameter is used to identifier the type of Map to use. The TextAnalyzer reads words from a text file. It counts the number of times (frequency) that the word appears in the file. The TextAnalyzer class does not write to System.out or any file
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
ITextAnalyzer.java is posted below:
import java.io.FileNotFoundException; import java.io.IOException; import java.util.Collection; public interface ITextAnalyzer { /** * Reads the words fom the text file and builds the word count data. * * @param filename * @throws FileNotFoundException * @throws IOException */ void analyzeText( String filename ) throws FileNotFoundException, IOException; /** * Returns the total number of words in the analyzed text file * @return */ long getWordCount(); /** * Returns the total number of unique words in the analyzed text file * @return */ long getUniqueWordCount(); /** * Returns the word data associated with the word. Returns null if the * word does nor exist in the analyzed text. * @param word * @return */ IWordData findWord( String word ); /** * Returns all the unique words in the analyzed text sorted by * frequency count in decending order. * @return */ Collection allWordsOrdedByFrequencyCount(); /** * Returns all the unique words in the analzed text sorted alphbetically * in ascending order. * @return */ Collection allWordsOrderByText(); } -----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
IWordData class is below
public interface IWordData { /** * Returns the number of times the word occurred in the analyzed text * @return */ long getFrequencyCount(); /** * Returns the word text * @return */ String getText(); } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
