Class Lexicon

java.lang.Object
  |
  +--Lexicon
Direct Known Subclasses:
DatabaseLexicon

public class Lexicon
extends java.lang.Object

Master word list. This class reads the word list file and sticks all the words in a hashtable. It deals with morphology and stuff.


Field Summary
protected  java.util.Hashtable table
           
 
Constructor Summary
Lexicon(java.lang.String fileName)
          Create a lexicon by reading in a file.
 
Method Summary
 LexItem[] getConstituents(java.lang.String word, int begin, PrologEngine engine)
          Get all the lexical items associated with some bit of text.
 void readFile(java.lang.String fileName)
          Read a lexicon file, adding its entries to the lexicon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

protected java.util.Hashtable table
Constructor Detail

Lexicon

public Lexicon(java.lang.String fileName)
Create a lexicon by reading in a file. See speech/domain/lexicon for notes on format.

Parameters:
fileName - the name of the initial lexicon file.
Throws:
java.lang.RuntimeException - for file errors.
Method Detail

readFile

public void readFile(java.lang.String fileName)
Read a lexicon file, adding its entries to the lexicon. Allows you to read as many lex files as necessary. See speech/domain/lexicon for notes on format.

Parameters:
fileName - the name of the lex file.
Throws:
java.lang.RuntimeException - for file errors.

getConstituents

public LexItem[] getConstituents(java.lang.String word,
                                 int begin,
                                 PrologEngine engine)
Get all the lexical items associated with some bit of text. There's one lexical item for every role on the word.

Parameters:
word - the text of the word to look up.
begin - the beginning of the constituents containing this word.
engine - a reference to prolog.
Returns:
an array of the lexical items on the word.
Throws:
UnknownWordException - for word not known.