Overview A concordance is an ordered listing of every word that occurs in some t
ID: 3644409 • Letter: O
Question
Overview
A concordance is an ordered listing of every word that occurs in some text, along with a count of the number of occurrences of the word, and a list of the line-numbers where the word occurs. For example: Text Concordance
See Spot run. bite 1 [3]
See Jane run. jane 2 [2, 4]
See Spot bite. run 4 [1, 2, 4]
Run Jane, run! see 3 [1, 2, 3]
spot 2 [1, 3]
I am able to get the text file into the program and put it all to lower case, but I can't figure out how to keep each word saved in a linked list and to keep track of the line number and how may times each word appears.
Specification
Your program should contain:
1. An OrderedList to represent an ascending-ordered list of Comparable elements. Your implementation must use a Java LinkedList to store the elements.
2. A class WordRecord to represent a concordance-entry consisting of a word, a count, and a line-number list. The list must be implemented using a Java LinkedList. You must provide a suitable constructor, toString(), accessor methods, and mutator update(int lineNumber), to update count and list. WordRecord must implement the Comparable interface.
3. A class TextFileScanner to support sequential extraction of the words from a line-structured text file. The constructor has a parameter for the name of the text file. Provide the following public methods: