Package 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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface edu.berkeley.nlp.lm.NgramLanguageModel
NgramLanguageModel.StaticMethods -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intprotected floatFixed constant returned when computing the log probability for an n-gram whose last word is not in the vocabulary. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractNgramLanguageModel(int lmOrder, WordIndexer<W> wordIndexer, float oovWordLogProb) -
Method Summary
Modifier and TypeMethodDescriptionintMaximum size of n-grams stored by the model.Each LM must have a WordIndexer which assigns integer IDs to each word W in the language.voidsetOovWordLogProb(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, waitMethods inherited from interface edu.berkeley.nlp.lm.NgramLanguageModel
getLogProb, scoreSentence
-
Field Details
-
lmOrder
protected final int lmOrder -
oovWordLogProb
protected float oovWordLogProbFixed 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 theunktag probability.
-
-
Constructor Details
-
AbstractNgramLanguageModel
-
-
Method Details
-
getLmOrder
public int getLmOrder()Description copied from interface:NgramLanguageModelMaximum size of n-grams stored by the model.- Specified by:
getLmOrderin interfaceNgramLanguageModel<W>- Returns:
-
getWordIndexer
Description copied from interface:NgramLanguageModelEach LM must have a WordIndexer which assigns integer IDs to each word W in the language.- Specified by:
getWordIndexerin interfaceNgramLanguageModel<W>- Returns:
-
setOovWordLogProb
public void setOovWordLogProb(float oovWordLogProb) Description copied from interface:NgramLanguageModelSets the (log) probability for an OOV word. Note that this is in general different from the log prob of theunktag probability.- Specified by:
setOovWordLogProbin interfaceNgramLanguageModel<W>
-