Question: JAVA Write a command line application, in the file Problem2.java that indexes the words contained in a text file (provided to the program as a
JAVA
Write a command line application, in the file Problem2.java that indexes the words contained in a text file (provided to the program as a command line argument). Your program should go through the input file line by line. For each line, extract each word, and insert that word, along with it's location into an AVL tree. Each element of the AVL tree should contain a unique word and a linked list of line numbers where that word occurs. If word already exists in the AVL Tree, simply add the new line number to the existing node. If a word appears on the same line twice, it should only have one entry in the list for that line. When you have finished, print out each unique word that appeared in the input file along with a list of line numbers on which that word appears. You may use Weiss' AVL tree code (https://github.com/elenawangcap/2016su.txt/blob/master/AvlTree.java) as a starting point for your program, you will need to modify it. Ignore case (insert everything as lower case), and strip out all punctuation. You may test your file on the attached textfile: https://github.com/elenawangcap/2016su.txt/blob/master/2016su.txt
UnderflowException.java /** * Exception class for access in empty containers * such as stacks, queues, and priority queues. * @author Mark Allen Weiss */ public class UnderflowException extends RuntimeException { }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
