/** ****************************************************************************** * HOMEWORK: 15-121 ****************************************************************************** * Text concordance program ****************************************************************************** * * A word is a sequence of two or more letters [a..zA..Z], digits [0..9] * and the undescore charatcter separated by non-letters. * We DO distinguish between upper- and lower-case letters. * This feature is supported by passing in a special comparator object. * * Notice, we do not include words consisting of a single letter. * * Because words can occur multiple times in a document, you have * to be able to keep track of the locations and occurrences of all words. * * The index of a word is simply the position of the word in the text. * * The frequency of a word is the number of occurences of the word in the text. * * * * @author * @date *****************************************************************************/ /***************************************************************************** IMPLEMENT THIS CLASS *****************************************************************************/ import java.util.*; public class Word implements Comparable { private String word; private Set index; //word's line number in the source text private int frequency; //counts occurences of the word }