edu.stanford.nlp.parser.lexparser
Interface Lexicon

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
BaseLexicon

public interface Lexicon
extends java.io.Serializable

An interface for lexicons


Field Summary
static java.lang.String BOUNDARY
           
static java.lang.String BOUNDARY_TAG
           
static java.lang.String UNKNOWN_WORD
           
 
Method Summary
 boolean isKnown(int word)
          Checks whether a word is in the lexicon.
 boolean isKnown(java.lang.String word)
          Checks whether a word is in the lexicon.
 void readData(java.io.BufferedReader in)
          Read the lexicon from the BufferedReader in the format written by writeData (an optional operation)
 java.util.Iterator ruleIteratorByWord(int word, int loc)
          Get an iterator over all rules with this word and loc
 double score(IntTaggedWord iTW, int loc)
          Get the score of this word with this tag (as an IntTaggedWord) at this loc (Presumably estimate of P(word | tag))
 void train(java.util.Collection trees)
          Trains this lexicon on the Collection of trees.
 void writeData(java.io.Writer w)
          Write the lexicon in human readable format to the Writer (an optional operation)
 

Field Detail

UNKNOWN_WORD

static final java.lang.String UNKNOWN_WORD
See Also:
Constant Field Values

BOUNDARY

static final java.lang.String BOUNDARY
See Also:
Constant Field Values

BOUNDARY_TAG

static final java.lang.String BOUNDARY_TAG
See Also:
Constant Field Values
Method Detail

isKnown

boolean isKnown(int word)
Checks whether a word is in the lexicon.

Parameters:
word - The word as an int
Returns:
Whether the word is in the lexicon

isKnown

boolean isKnown(java.lang.String word)
Checks whether a word is in the lexicon.

Parameters:
word - The word as a String
Returns:
Whether the word is in the lexicon

ruleIteratorByWord

java.util.Iterator ruleIteratorByWord(int word,
                                      int loc)
Get an iterator over all rules with this word and loc

Parameters:
word -
loc -
Returns:
an Iterator over rules

train

void train(java.util.Collection trees)
Trains this lexicon on the Collection of trees.


score

double score(IntTaggedWord iTW,
             int loc)
Get the score of this word with this tag (as an IntTaggedWord) at this loc (Presumably estimate of P(word | tag))

Parameters:
iTW -
loc -
Returns:
a double valued score

writeData

void writeData(java.io.Writer w)
               throws java.io.IOException
Write the lexicon in human readable format to the Writer (an optional operation)

Parameters:
w - the writer to output to
Throws:
java.io.IOException

readData

void readData(java.io.BufferedReader in)
              throws java.io.IOException
Read the lexicon from the BufferedReader in the format written by writeData (an optional operation)

Parameters:
in -
Throws:
java.io.IOException