V
- Value typepublic final class FirstPassCallback<V extends LongRepresentable<V>> extends java.lang.Object implements ArpaLmReaderCallback<V>
Constructor and Description |
---|
FirstPassCallback(boolean reverse) |
Modifier and Type | Method and Description |
---|---|
void |
call(int[] ngram,
int startPos,
int endPos,
V v,
java.lang.String words)
Called for each n-gram
|
void |
cleanup()
Called once all reading is done.
|
long[] |
getNumNgramsForEachOrder() |
LongArray[] |
getNumNgramsForEachWord() |
LongToIntHashMap |
getValueCounter() |
void |
handleNgramOrderFinished(int order)
Called when all n-grams of a given order are finished
|
void |
handleNgramOrderStarted(int order)
Called when n-grams of a given order are started
|
void |
initWithLengths(java.util.List<java.lang.Long> numNGrams)
Called initially with a list of how many n-grams will appear for each
order.
|
public void call(int[] ngram, int startPos, int endPos, V v, java.lang.String words)
LmReaderCallback
call
in interface LmReaderCallback<V extends LongRepresentable<V>>
ngram
- The integer representation of the words as given by the
provided WordIndexerv
- The value of the n-gramwords
- The string representation of the n-gram (space separated)public void handleNgramOrderFinished(int order)
NgramOrderedLmReaderCallback
handleNgramOrderFinished
in interface NgramOrderedLmReaderCallback<V extends LongRepresentable<V>>
public void cleanup()
LmReaderCallback
cleanup
in interface LmReaderCallback<V extends LongRepresentable<V>>
public LongToIntHashMap getValueCounter()
public void initWithLengths(java.util.List<java.lang.Long> numNGrams)
ArpaLmReaderCallback
initWithLengths
in interface ArpaLmReaderCallback<V extends LongRepresentable<V>>
numNGrams
- maps n-gram orders to number of n-grams (i.e. numNGrams.get(0)
is the number of unigrams)public LongArray[] getNumNgramsForEachWord()
public long[] getNumNgramsForEachOrder()
public void handleNgramOrderStarted(int order)
NgramOrderedLmReaderCallback
handleNgramOrderStarted
in interface NgramOrderedLmReaderCallback<V extends LongRepresentable<V>>