TextCompressor::DictionaryEncoder
Inherits TextCompressor::Encoder < Reference < Object
The Dictionary Encoder uses a mapping algorithm to generate a unique encoding for each word selected for compression. Words are grouped by starting char and length. For examples, the word "apple" would be encoded to "a4" If another 5-letter a-word was added it would look like this: {"apple" => "a3e", "artsy" => "a3y"}, and so on.
Instance methods
conflict_words
set of all words that caused a conflict during encoding needs to be saved for reference when decoding as well
counter
SourceReturns the encoded list of tokens
encoding_keys
Returns a list of mappings to be appended to the compressed file. The mappings are required to decode the compressed file.
input_tokens
Sourceremainder
Source