Package edu.berkeley.nlp.lm.values
Interface ValueContainer<V>
-
- Type Parameters:
V-
- All Superinterfaces:
java.io.Serializable
- All Known Subinterfaces:
CompressibleValueContainer<V>,ProbBackoffValueContainer
- All Known Implementing Classes:
CompressibleProbBackoffValueContainer,CountValueContainer,KneserNeyCountValueContainer,PhraseTableValueContainer,UncompressedProbBackoffValueContainer,UnrankedUncompressedProbBackoffValueContainer
public interface ValueContainer<V> extends java.io.SerializableManages storage of arbitrary values in an NgramMap- Author:
- adampauls
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanadd(int[] ngram, int startPos, int endPos, int ngramOrder, long offset, long contextOffset, int word, V val, long suffixOffset, boolean ngramIsNew)Adds a new value at the specified offset.voidclearStorageForOrder(int ngramOrder)ValueContainer<V>createFreshValues(long[] numNgramsForEachOrder)Creates a fresh value container for copying purposes.voidgetFromOffset(long offset, int ngramOrder, V outputVal)Gets the value living at a particular offset.VgetScratchValue()Creates a fresh value of object (useful for passing as an output parameter)intnumValueBits(int ngramOrder)voidsetFromOtherValues(ValueContainer<V> other)Destructively sets internal storage from another object.voidsetMap(NgramMap<V> map)Initializes a value container with the map that contains itvoidsetSizeAtLeast(long size, int ngramOrder)Sets internal storage for size for a particular n-gram orderbooleanstoreSuffixoffsets()voidtrim()Final clean up of storage.voidtrimAfterNgram(int ngramOrder, long size)Clear storage after an n-gram order is complete
-
-
-
Method Detail
-
add
boolean add(int[] ngram, int startPos, int endPos, int ngramOrder, long offset, long contextOffset, int word, V val, long suffixOffset, boolean ngramIsNew)Adds a new value at the specified offset.- Parameters:
ngramOrder- As always, ngramOrder is 0-based (0=unigram)offset-contextOffset-word-val-suffixOffset-- Returns:
- Whether or not the add was successful
-
setSizeAtLeast
void setSizeAtLeast(long size, int ngramOrder)Sets internal storage for size for a particular n-gram order- Parameters:
size-ngramOrder-
-
createFreshValues
ValueContainer<V> createFreshValues(long[] numNgramsForEachOrder)
Creates a fresh value container for copying purposes.- Returns:
-
getFromOffset
void getFromOffset(long offset, int ngramOrder, V outputVal)Gets the value living at a particular offset.- Parameters:
offset-ngramOrder-
-
setFromOtherValues
void setFromOtherValues(ValueContainer<V> other)
Destructively sets internal storage from another object.- Parameters:
other-
-
trimAfterNgram
void trimAfterNgram(int ngramOrder, long size)Clear storage after an n-gram order is complete- Parameters:
ngramOrder-size-
-
trim
void trim()
Final clean up of storage.
-
getScratchValue
V getScratchValue()
Creates a fresh value of object (useful for passing as an output parameter)- Returns:
-
clearStorageForOrder
void clearStorageForOrder(int ngramOrder)
-
storeSuffixoffsets
boolean storeSuffixoffsets()
-
numValueBits
int numValueBits(int ngramOrder)
-
-