public class Huffman extends Object
| Modifier and Type | Field and Description |
|---|---|
int |
MAX_CODE_LENGTH |
| Constructor and Description |
|---|
Huffman(Collection<? extends SequenceElement> words) |
Huffman(Collection<? extends SequenceElement> words,
int CODE_LENGTH)
Builds Huffman tree for collection of SequenceElements, with defined CODE_LENGTH
Default CODE_LENGTH is 40
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyIndexes(VocabCache<? extends SequenceElement> cache)
This method updates VocabCache and all it's elements with Huffman indexes
Please note: it should be the same VocabCache as was used for Huffman tree initialization
|
void |
build() |
public Huffman(Collection<? extends SequenceElement> words)
public Huffman(Collection<? extends SequenceElement> words, int CODE_LENGTH)
words - CODE_LENGTH - CODE_LENGTH defines maximum length of code path, and effectively limits vocabulary size.public void build()
public void applyIndexes(VocabCache<? extends SequenceElement> cache)
cache - VocabCache to be updated.Copyright © 2018. All rights reserved.