Question: Complete this project using java.In this project you will implement a bag of words (BoW), its a class. A BoW collects all words from input
Complete this project using java.In this project you will implement a bag of words (BoW), its a class. A BoW collects all words from input text files as a multi-set (meaning repeated words are maintained with multiplicity), and enables the calculation of certain statistics that help identify the importance of the words to a corpus (BoW). In this project you may represent it as a set (no repetition allowed) rather than a multi-set, while maintaining occurrence counts (frequencies).
You should write a BoW class that is capable of doing the following: 1.Constructor: BoW(String text_file_name). This will create a BoW object initializing it with the words from the input text file. 2. Public Method 1: expand(String another_text_file_name). This will absorb into the BoW all words from the new text file. 3.Public Method 2: printTermFrequency(). This will print a list of all distinct words currently in the objects set, and their frequencies (number of occurrences). 4. Public Method 3: printInverseDocumentFrequency(). This will print a list of all distinct words currently in the objects set, and for each word, will print the ratio of the total number of documents (absorbed into the BoW so far) to the number of documents in which that word appears.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
