Package edu.berkeley.nlp.lm.values
Class UnrankedUncompressedProbBackoffValueContainer
- java.lang.Object
-
- edu.berkeley.nlp.lm.values.UnrankedUncompressedProbBackoffValueContainer
-
- All Implemented Interfaces:
ProbBackoffValueContainer,ValueContainer<ProbBackoffPair>,java.io.Serializable
public final class UnrankedUncompressedProbBackoffValueContainer extends java.lang.Object implements ProbBackoffValueContainer
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UnrankedUncompressedProbBackoffValueContainer(boolean storePrefixes, long[] numNgramsForEachOrder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(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)UnrankedUncompressedProbBackoffValueContainercreateFreshValues(long[] numNgramsForEachOrder_)Creates a fresh value container for copying purposes.floatgetBackoff(int ngramOrder, long index)voidgetFromOffset(long index, int ngramOrder, ProbBackoffPair outputVal)Gets the value living at a particular offset.floatgetProb(int ngramOrder, long index)ProbBackoffPairgetScratchValue()Creates a fresh value of object (useful for passing as an output parameter)longgetSuffixOffset(long index, int ngramOrder)intnumValueBits(int ngramOrder)voidsetFromOtherValues(ValueContainer<ProbBackoffPair> other)Destructively 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 orderbooleanstoreSuffixoffsets()voidtrim()Final clean up of storage.voidtrimAfterNgram(int ngramOrder, long size)Clear storage after an n-gram order is complete
-
-
-
Method Detail
-
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
public void getFromOffset(long index, int ngramOrder, ProbBackoffPair outputVal)Description copied from interface:ValueContainerGets the value living at a particular offset.- Specified by:
getFromOffsetin interfaceValueContainer<ProbBackoffPair>
-
getBackoff
public final float getBackoff(int ngramOrder, long index)- Specified by:
getBackoffin interfaceProbBackoffValueContainer
-
getScratchValue
public ProbBackoffPair 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
public void setFromOtherValues(ValueContainer<ProbBackoffPair> other)
Description copied from interface:ValueContainerDestructively sets internal storage from another object.- Specified by:
setFromOtherValuesin interfaceValueContainer<ProbBackoffPair>
-
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>ngramOrder- As always, ngramOrder is 0-based (0=unigram)- 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>
-
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>
-
setMap
public void setMap(NgramMap<ProbBackoffPair> map)
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>
-
-