public class ScaleTrieReader extends Object
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 and Description |
|---|
ScaleTrieReader(TrieReader reader,
double scale)
Construct a scaling trie reader wrapping the specified
reader and scaling counts with the specified value.
|
| Modifier and Type | Method and Description |
|---|---|
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. |
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.IOExceptionpublic long readCount()
TrieReaderreadCount in interface TrieReaderpublic 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.Copyright © 2016 Alias-i, Inc.. All rights reserved.