|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Lexicon
An interface for lexicons interfacing to lexparser. Its primary responsibility is to provide a conditional probability P(word|tag), which is fulfilled by the {#score} method. Inside the lexparser, Strings are interned and tags and words are usually represented as integers.
Field Summary | |
---|---|
static java.lang.String |
BOUNDARY
|
static java.lang.String |
BOUNDARY_TAG
|
static java.lang.String |
UNKNOWN_WORD
|
Method Summary | |
---|---|
UnknownWordModel |
getUnknownWordModel()
|
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. |
int |
numRules()
Returns the number of rules (tag rewrites as word) in the Lexicon. |
void |
readData(java.io.BufferedReader in)
Read the lexicon from the BufferedReader in the format written by writeData. |
java.util.Iterator<IntTaggedWord> |
ruleIteratorByWord(int word,
int loc,
java.lang.String featureSpec)
Get an iterator over all rules (pairs of (word, POS)) for this word. |
float |
score(IntTaggedWord iTW,
int loc)
Get the score of this word with this tag (as an IntTaggedWord) at this loc. |
void |
setUnknownWordModel(UnknownWordModel uwm)
|
void |
train(java.util.Collection<Tree> 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. |
Field Detail |
---|
static final java.lang.String UNKNOWN_WORD
static final java.lang.String BOUNDARY
static final java.lang.String BOUNDARY_TAG
Method Detail |
---|
boolean isKnown(int word)
word
- The word as an int
boolean isKnown(java.lang.String word)
word
- The word as a String
java.util.Iterator<IntTaggedWord> ruleIteratorByWord(int word, int loc, java.lang.String featureSpec)
word
- The word, represented as an integer in Numbererloc
- The position of the word in the sentence (counting from 0).
Implementation note: The BaseLexicon class doesn't
actually make use of this position information.featureSpec
- Additional word features like morphosyntactic information.
tag -> word rule.)
int numRules()
void train(java.util.Collection<Tree> trees)
trees
- Trees to train onfloat score(IntTaggedWord iTW, int loc)
iTW
- An IntTaggedWord pairing a word and POS tagloc
- The position in the sentence. In the default implementation
this is used only for unknown words to change their
probability distribution when sentence initial.
void writeData(java.io.Writer w) throws java.io.IOException
w
- The writer to output to
java.io.IOException
- If any I/O problemvoid readData(java.io.BufferedReader in) throws java.io.IOException
in
- The BufferedReader to read from
java.io.IOException
- If any I/O problemUnknownWordModel getUnknownWordModel()
void setUnknownWordModel(UnknownWordModel uwm)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |