|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.aliasi.lm.ScaleTrieReader
public class ScaleTrieReader
A ScaleTrieReader filters a contained trie
reader by scaling all counts by a given multiple, removing
all subtrees with zero root counts. Counts are rounded
after multiplication using Math.round(double).
Thus pruning will only occur if the scaling factor is less
than 0.5, because 0.5 rounds to 1.
| Constructor Summary | |
|---|---|
ScaleTrieReader(TrieReader reader,
double scale)
Construct a scaling trie reader wrapping the specified reader and scaling counts with the specified value. |
|
| Method Summary | |
|---|---|
long |
readCount()
Returns the count of the next tree. |
long |
readSymbol()
Returns the identifier of the symbol leading from the root of the current tree to the daughter subtree for the symbol, or -1 if there are no more subtrees for the current
node. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ScaleTrieReader(TrieReader reader,
double scale)
throws IOException
reader - Contained reader.scale - Scaling factor.
IllegalArgumentException - If the scale is not a
positive, non-infinite value.
IOException| Method Detail |
|---|
public long readCount()
TrieReader
readCount in interface TrieReader
public long readSymbol()
throws IOException
TrieReader-1 if there are no more subtrees for the current
node.
readSymbol in interface TrieReaderIOException - If there is an underlying I/O error.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||