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 boolean
add(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.void
clearStorageForOrder(int ngramOrder)
UnrankedUncompressedProbBackoffValueContainer
createFreshValues(long[] numNgramsForEachOrder_)
Creates a fresh value container for copying purposes.float
getBackoff(int ngramOrder, long index)
void
getFromOffset(long index, int ngramOrder, ProbBackoffPair outputVal)
Gets the value living at a particular offset.float
getProb(int ngramOrder, long index)
ProbBackoffPair
getScratchValue()
Creates a fresh value of object (useful for passing as an output parameter)long
getSuffixOffset(long index, int ngramOrder)
int
numValueBits(int ngramOrder)
void
setFromOtherValues(ValueContainer<ProbBackoffPair> other)
Destructively sets internal storage from another object.void
setMap(NgramMap<ProbBackoffPair> map)
Initializes a value container with the map that contains itvoid
setSizeAtLeast(long size, int ngramOrder)
Sets internal storage for size for a particular n-gram orderboolean
storeSuffixoffsets()
void
trim()
Final clean up of storage.void
trimAfterNgram(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:ValueContainer
Creates a fresh value container for copying purposes.- Specified by:
createFreshValues
in interfaceValueContainer<ProbBackoffPair>
- Returns:
-
getProb
public final float getProb(int ngramOrder, long index)
- Specified by:
getProb
in interfaceProbBackoffValueContainer
-
getFromOffset
public void getFromOffset(long index, int ngramOrder, ProbBackoffPair outputVal)
Description copied from interface:ValueContainer
Gets the value living at a particular offset.- Specified by:
getFromOffset
in interfaceValueContainer<ProbBackoffPair>
-
getBackoff
public final float getBackoff(int ngramOrder, long index)
- Specified by:
getBackoff
in interfaceProbBackoffValueContainer
-
getScratchValue
public ProbBackoffPair getScratchValue()
Description copied from interface:ValueContainer
Creates a fresh value of object (useful for passing as an output parameter)- Specified by:
getScratchValue
in interfaceProbBackoffValueContainer
- Specified by:
getScratchValue
in interfaceValueContainer<ProbBackoffPair>
- Returns:
-
setFromOtherValues
public void setFromOtherValues(ValueContainer<ProbBackoffPair> other)
Description copied from interface:ValueContainer
Destructively sets internal storage from another object.- Specified by:
setFromOtherValues
in interfaceValueContainer<ProbBackoffPair>
-
trim
public void trim()
Description copied from interface:ValueContainer
Final clean up of storage.- Specified by:
trim
in interfaceValueContainer<ProbBackoffPair>
-
storeSuffixoffsets
public boolean storeSuffixoffsets()
- Specified by:
storeSuffixoffsets
in interfaceValueContainer<ProbBackoffPair>
-
numValueBits
public int numValueBits(int ngramOrder)
- Specified by:
numValueBits
in 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:ValueContainer
Adds a new value at the specified offset.- Specified by:
add
in 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:ValueContainer
Sets internal storage for size for a particular n-gram order- Specified by:
setSizeAtLeast
in interfaceValueContainer<ProbBackoffPair>
-
getSuffixOffset
public long getSuffixOffset(long index, int ngramOrder)
- Specified by:
getSuffixOffset
in interfaceProbBackoffValueContainer
-
trimAfterNgram
public void trimAfterNgram(int ngramOrder, long size)
Description copied from interface:ValueContainer
Clear storage after an n-gram order is complete- Specified by:
trimAfterNgram
in interfaceValueContainer<ProbBackoffPair>
-
setMap
public void setMap(NgramMap<ProbBackoffPair> map)
Description copied from interface:ValueContainer
Initializes a value container with the map that contains it- Specified by:
setMap
in interfaceValueContainer<ProbBackoffPair>
-
clearStorageForOrder
public void clearStorageForOrder(int ngramOrder)
- Specified by:
clearStorageForOrder
in interfaceValueContainer<ProbBackoffPair>
-
-