edu.berkeley.nlp.lm
Class AbstractNgramLanguageModel<W>
java.lang.Object
edu.berkeley.nlp.lm.AbstractNgramLanguageModel<W>
- All Implemented Interfaces:
- NgramLanguageModel<W>, Serializable
- Direct Known Subclasses:
- AbstractArrayEncodedNgramLanguageModel, AbstractContextEncodedNgramLanguageModel
public abstract class AbstractNgramLanguageModel<W>
- extends Object
- implements NgramLanguageModel<W>, Serializable
- See Also:
- Serialized Form
Field Summary |
protected int |
lmOrder
|
protected float |
oovWordLogProb
Fixed constant returned when computing the log probability for an n-gram
whose last word is not in the vocabulary. |
Method Summary |
int |
getLmOrder()
Maximum size of n-grams stored by the model. |
WordIndexer<W> |
getWordIndexer()
Each LM must have a WordIndexer which assigns integer IDs to each word W
in the language. |
void |
setOovWordLogProb(float oovWordLogProb)
Sets the (log) probability for an OOV word. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
lmOrder
protected final int lmOrder
oovWordLogProb
protected float oovWordLogProb
- Fixed constant returned when computing the log probability for an n-gram
whose last word is not in the vocabulary. Note that this is different
from the log prob of the
unk
tag probability.
AbstractNgramLanguageModel
public AbstractNgramLanguageModel(int lmOrder,
WordIndexer<W> wordIndexer,
float oovWordLogProb)
getLmOrder
public int getLmOrder()
- Description copied from interface:
NgramLanguageModel
- Maximum size of n-grams stored by the model.
- Specified by:
getLmOrder
in interface NgramLanguageModel<W>
- Returns:
getWordIndexer
public WordIndexer<W> getWordIndexer()
- Description copied from interface:
NgramLanguageModel
- Each LM must have a WordIndexer which assigns integer IDs to each word W
in the language.
- Specified by:
getWordIndexer
in interface NgramLanguageModel<W>
- Returns:
setOovWordLogProb
public void setOovWordLogProb(float oovWordLogProb)
- Description copied from interface:
NgramLanguageModel
- Sets the (log) probability for an OOV word. Note that this is in general
different from the log prob of the
unk
tag probability.
- Specified by:
setOovWordLogProb
in interface NgramLanguageModel<W>