|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.sphinx.linguist.language.ngram.large.BinaryLoader
public class BinaryLoader
Reads a binary language model file generated by the CMU-Cambridge Statistical Language Modelling Toolkit.
Note that all probabilites in the grammar are stored in LogMath log base format. Language Probabilties in the language model file are stored in log 10 base. They are converted to the LogMath logbase.
Constructor Summary | |
---|---|
BinaryLoader(java.lang.String format,
java.io.File location,
boolean applyLanguageWeightAndWip,
LogMath logMath,
float languageWeight,
double wip,
float unigramWeight)
Initializes the binary loader |
Method Summary | |
---|---|
boolean |
getBigEndian()
Returns true if the loaded file is in big-endian. |
int |
getBigramOffset()
Returns the location (or offset) into the file where bigrams start. |
float[] |
getBigramProbabilities()
Returns all the bigram probabilities. |
int |
getLogBigramSegmentSize()
Returns the log of the bigram segment size |
int |
getMaxDepth()
Returns the maximum depth of the language model |
int |
getNumberBigrams()
Returns the number of bigrams |
int |
getNumberTrigrams()
Returns the number of trigrams |
int |
getNumberUnigrams()
Returns the number of unigrams |
float[] |
getTrigramBackoffWeights()
Returns all the trigram backoff weights |
int |
getTrigramOffset()
Returns the location (or offset) into the file where trigrams start. |
float[] |
getTrigramProbabilities()
Returns all the trigram probabilities. |
int[] |
getTrigramSegments()
Returns the trigram segment table. |
edu.cmu.sphinx.linguist.language.ngram.large.UnigramProbability[] |
getUnigrams()
Returns all the unigrams |
java.lang.String[] |
getWords()
Returns all the words. |
byte[] |
loadBuffer(long position,
int size)
Loads the contents of the memory-mapped file starting at the given position and for the given size, into a byte buffer. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BinaryLoader(java.lang.String format, java.io.File location, boolean applyLanguageWeightAndWip, LogMath logMath, float languageWeight, double wip, float unigramWeight) throws java.io.IOException
format
- the file formatlocation
- the location of the modelapplyLanguageWeightAndWip
- if true apply lw and wiplogMath
- the logmath to suelanguageWeight
- the language weightwip
- the word insertion probabilityunigramWeight
- the unigram weight
java.io.IOException
- if an I/O error occursMethod Detail |
---|
public int getNumberUnigrams()
public int getNumberBigrams()
public int getNumberTrigrams()
public edu.cmu.sphinx.linguist.language.ngram.large.UnigramProbability[] getUnigrams()
public float[] getBigramProbabilities()
public float[] getTrigramProbabilities()
public float[] getTrigramBackoffWeights()
public int[] getTrigramSegments()
public int getLogBigramSegmentSize()
public java.lang.String[] getWords()
public int getBigramOffset()
public int getTrigramOffset()
public int getMaxDepth()
public boolean getBigEndian()
public byte[] loadBuffer(long position, int size) throws java.io.IOException
position
- the starting position in the filesize
- the number of bytes to load
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |