com.aliasi.lm
Interface TrieReader

All Known Implementing Classes:
BitTrieReader, MultiTrieReader, PruneTrieReader, ScaleTrieReader

public interface TrieReader

The TrieReader interface provides a means to read a trie structure with counts.

See TrieWriter for a description of how a trie is encoded as a sequence of long values.

Since:
LingPipe2.3
Version:
2.3
Author:
Bob Carpenter

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.
 

Method Detail

readSymbol

long readSymbol()
                throws IOException
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.

Returns:
The symbol leading to the next subtree.
Throws:
IOException - If there is an underlying I/O error.
IllegalStateException - If the next item to be read is not a symbol.

readCount

long readCount()
               throws IOException
Returns the count of the next tree.

Returns:
The count of the next tree.
Throws:
IOException - If there is an underlying I/O error.
IllegalStateException - If the next item to be read is not a count.