edu.berkeley.nlp.lm.values
Class UnrankedUncompressedProbBackoffValueContainer

java.lang.Object
  extended by edu.berkeley.nlp.lm.values.UnrankedUncompressedProbBackoffValueContainer
All Implemented Interfaces:
ProbBackoffValueContainer, ValueContainer<ProbBackoffPair>, Serializable

public final class UnrankedUncompressedProbBackoffValueContainer
extends Object
implements ProbBackoffValueContainer

See Also:
Serialized Form

Constructor Summary
UnrankedUncompressedProbBackoffValueContainer(boolean storePrefixes, long[] numNgramsForEachOrder)
           
 
Method Summary
 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 it
 void setSizeAtLeast(long size, int ngramOrder)
          Sets internal storage for size for a particular n-gram order
 boolean storeSuffixoffsets()
           
 void trim()
          Final clean up of storage.
 void trimAfterNgram(int ngramOrder, long size)
          Clear storage after an n-gram order is complete
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnrankedUncompressedProbBackoffValueContainer

public UnrankedUncompressedProbBackoffValueContainer(boolean storePrefixes,
                                                     long[] numNgramsForEachOrder)
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 interface ValueContainer<ProbBackoffPair>
Returns:

getProb

public final float getProb(int ngramOrder,
                           long index)
Specified by:
getProb in interface ProbBackoffValueContainer

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 interface ValueContainer<ProbBackoffPair>

getBackoff

public final float getBackoff(int ngramOrder,
                              long index)
Specified by:
getBackoff in interface ProbBackoffValueContainer

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 interface ProbBackoffValueContainer
Specified by:
getScratchValue in interface ValueContainer<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 interface ValueContainer<ProbBackoffPair>

trim

public void trim()
Description copied from interface: ValueContainer
Final clean up of storage.

Specified by:
trim in interface ValueContainer<ProbBackoffPair>

storeSuffixoffsets

public boolean storeSuffixoffsets()
Specified by:
storeSuffixoffsets in interface ValueContainer<ProbBackoffPair>

numValueBits

public int numValueBits(int ngramOrder)
Specified by:
numValueBits in interface ValueContainer<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 interface ValueContainer<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 interface ValueContainer<ProbBackoffPair>

getSuffixOffset

public long getSuffixOffset(long index,
                            int ngramOrder)
Specified by:
getSuffixOffset in interface ProbBackoffValueContainer

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 interface ValueContainer<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 interface ValueContainer<ProbBackoffPair>

clearStorageForOrder

public void clearStorageForOrder(int ngramOrder)
Specified by:
clearStorageForOrder in interface ValueContainer<ProbBackoffPair>