Package edu.berkeley.nlp.lm.values
Class UnrankedUncompressedProbBackoffValueContainer
java.lang.Object
edu.berkeley.nlp.lm.values.UnrankedUncompressedProbBackoffValueContainer
- All Implemented Interfaces:
ProbBackoffValueContainer,ValueContainer<ProbBackoffPair>,Serializable
public final class UnrankedUncompressedProbBackoffValueContainer
extends Object
implements ProbBackoffValueContainer
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionUnrankedUncompressedProbBackoffValueContainer(boolean storePrefixes, long[] numNgramsForEachOrder) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(int[] ngram, int startPos, int endPos, int ngramOrder, long offset, long contextOffset, int word, ProbBackoffPair val_, long suffixOffset, boolean ngramIsNew) Adds a new value at the specified offset.voidclearStorageForOrder(int ngramOrder) createFreshValues(long[] numNgramsForEachOrder_) Creates a fresh value container for copying purposes.final floatgetBackoff(int ngramOrder, long index) voidgetFromOffset(long index, int ngramOrder, ProbBackoffPair outputVal) Gets the value living at a particular offset.final floatgetProb(int ngramOrder, long index) Creates a fresh value of object (useful for passing as an output parameter)longgetSuffixOffset(long index, int ngramOrder) intnumValueBits(int ngramOrder) voidDestructively sets internal storage from another object.voidsetMap(NgramMap<ProbBackoffPair> 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 orderbooleanvoidtrim()Final clean up of storage.voidtrimAfterNgram(int ngramOrder, long size) Clear storage after an n-gram order is complete
-
Constructor Details
-
UnrankedUncompressedProbBackoffValueContainer
public UnrankedUncompressedProbBackoffValueContainer(boolean storePrefixes, long[] numNgramsForEachOrder)
-
-
Method Details
-
createFreshValues
public UnrankedUncompressedProbBackoffValueContainer createFreshValues(long[] numNgramsForEachOrder_) Description copied from interface:ValueContainerCreates a fresh value container for copying purposes.- Specified by:
createFreshValuesin interfaceValueContainer<ProbBackoffPair>- Returns:
-
getProb
public final float getProb(int ngramOrder, long index) - Specified by:
getProbin interfaceProbBackoffValueContainer
-
getFromOffset
Description copied from interface:ValueContainerGets the value living at a particular offset.- Specified by:
getFromOffsetin interfaceValueContainer<ProbBackoffPair>- Parameters:
index-ngramOrder-
-
getBackoff
public final float getBackoff(int ngramOrder, long index) - Specified by:
getBackoffin interfaceProbBackoffValueContainer
-
getScratchValue
Description copied from interface:ValueContainerCreates a fresh value of object (useful for passing as an output parameter)- Specified by:
getScratchValuein interfaceProbBackoffValueContainer- Specified by:
getScratchValuein interfaceValueContainer<ProbBackoffPair>- Returns:
-
setFromOtherValues
Description copied from interface:ValueContainerDestructively sets internal storage from another object.- Specified by:
setFromOtherValuesin interfaceValueContainer<ProbBackoffPair>- Parameters:
other-
-
trim
public void trim()Description copied from interface:ValueContainerFinal clean up of storage.- Specified by:
trimin interfaceValueContainer<ProbBackoffPair>
-
storeSuffixoffsets
public boolean storeSuffixoffsets()- Specified by:
storeSuffixoffsetsin interfaceValueContainer<ProbBackoffPair>
-
numValueBits
public int numValueBits(int ngramOrder) - Specified by:
numValueBitsin interfaceValueContainer<ProbBackoffPair>
-
add
public boolean add(int[] ngram, int startPos, int endPos, int ngramOrder, long offset, long contextOffset, int word, ProbBackoffPair val_, long suffixOffset, boolean ngramIsNew) Description copied from interface:ValueContainerAdds a new value at the specified offset.- Specified by:
addin interfaceValueContainer<ProbBackoffPair>- Parameters:
ngramOrder- As always, ngramOrder is 0-based (0=unigram)offset-contextOffset-word-val_-suffixOffset-- Returns:
- Whether or not the add was successful
-
setSizeAtLeast
public void setSizeAtLeast(long size, int ngramOrder) Description copied from interface:ValueContainerSets internal storage for size for a particular n-gram order- Specified by:
setSizeAtLeastin interfaceValueContainer<ProbBackoffPair>- Parameters:
size-ngramOrder-
-
getSuffixOffset
public long getSuffixOffset(long index, int ngramOrder) - Specified by:
getSuffixOffsetin interfaceProbBackoffValueContainer
-
trimAfterNgram
public void trimAfterNgram(int ngramOrder, long size) Description copied from interface:ValueContainerClear storage after an n-gram order is complete- Specified by:
trimAfterNgramin interfaceValueContainer<ProbBackoffPair>- Parameters:
ngramOrder-size-
-
setMap
Description copied from interface:ValueContainerInitializes a value container with the map that contains it- Specified by:
setMapin interfaceValueContainer<ProbBackoffPair>
-
clearStorageForOrder
public void clearStorageForOrder(int ngramOrder) - Specified by:
clearStorageForOrderin interfaceValueContainer<ProbBackoffPair>
-