public class NgramTrieQuant
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
NgramTrieQuant.QuantType |
Constructor and Description |
---|
NgramTrieQuant(int order,
NgramTrieQuant.QuantType quantType) |
Modifier and Type | Method and Description |
---|---|
int |
getBackoffTableLen()
Getter for length of backoffs quantation table.
|
int |
getProbBoSize()
Getter for size of quantaized weights in ngram trie.
|
int |
getProbSize()
Getter for size of quantaized weight in ngram trie
|
int |
getProbTableLen()
Getter for length of probability quantation table.
|
float |
readBackoff(NgramTrieBitarr bitArr,
int memPtr,
int bitOffset,
int orderMinusTwo)
Reads encoded backoff from provided trie bit array and decodes it into actual value
for specific ngram
|
float |
readProb(NgramTrieBitarr bitArr,
int memPtr,
int bitOffset,
int orderMinusTwo)
Reads encoded probability from provided trie bit array and decodes it into actual value
for specific ngram
|
void |
setTable(float[] table,
int order,
boolean isProb)
Setter that is used during quantation reading
|
public NgramTrieQuant(int order, NgramTrieQuant.QuantType quantType)
public void setTable(float[] table, int order, boolean isProb)
table
- - array of weights to be used as quantation tableorder
- - ngrams order which quantation table corresponds toisProb
- - specifies if provided table is for probability (backoffs otherwise)public int getProbTableLen()
public int getBackoffTableLen()
public int getProbBoSize()
public int getProbSize()
public float readProb(NgramTrieBitarr bitArr, int memPtr, int bitOffset, int orderMinusTwo)
bitArr
- - trie bit arraymemPtr
- - memory pointer for specific ngram orderbitOffset
- - offset from memPtr that is calculated according to ngram indexorderMinusTwo
- - order of ngram minus twopublic float readBackoff(NgramTrieBitarr bitArr, int memPtr, int bitOffset, int orderMinusTwo)
bitArr
- - trie bit arraymemPtr
- - memory pointer for specific ngram orderbitOffset
- - offset from memPtr that is calculated according to ngram indexorderMinusTwo
- - order of ngram minus two