Package edu.berkeley.nlp.lm.cache
Class ContextEncodedDirectMappedLmCache
java.lang.Object
edu.berkeley.nlp.lm.cache.ContextEncodedDirectMappedLmCache
- All Implemented Interfaces:
ContextEncodedLmCache,Serializable
public final class ContextEncodedDirectMappedLmCache
extends Object
implements ContextEncodedLmCache
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcapacity()floatgetCached(long contextOffset, int contextOrder, int word, int hash, ContextEncodedNgramLanguageModel.LmContextInfo outputPrefix) Should return Float.NaN if requested n-gram is not in the cache.voidputCached(long contextOffset, int contextOrder, int word, float score, int hash, ContextEncodedNgramLanguageModel.LmContextInfo outputPrefix)
-
Constructor Details
-
ContextEncodedDirectMappedLmCache
public ContextEncodedDirectMappedLmCache(int cacheBits, boolean threadSafe)
-
-
Method Details
-
getCached
public float getCached(long contextOffset, int contextOrder, int word, int hash, ContextEncodedNgramLanguageModel.LmContextInfo outputPrefix) Description copied from interface:ContextEncodedLmCacheShould return Float.NaN if requested n-gram is not in the cache.- Specified by:
getCachedin interfaceContextEncodedLmCache- Parameters:
contextOffset-contextOrder-word-hash-outputPrefix-- Returns:
-
putCached
public void putCached(long contextOffset, int contextOrder, int word, float score, int hash, ContextEncodedNgramLanguageModel.LmContextInfo outputPrefix) - Specified by:
putCachedin interfaceContextEncodedLmCache
-
capacity
public int capacity()- Specified by:
capacityin interfaceContextEncodedLmCache
-