Example #1
0
 def run_encoding_algorithm(self, text):
     """Run LZW after Huffman"""
     huf_res = HuffmanCompress(text)
     lzw_res = LZW(huf_res.compress_data())
     res = lzw_res.encode_text()
     self.huf_codes = huf_res.codes_dict
     self.lzw_codes = lzw_res.code_dict
     self.code_intervals = lzw_res.encoded_insert_length
     return res
Example #2
0
 def test_lzw_encode_text(self):
     txt = "beep boop beer!"
     code = LZW(txt)
     self.assertEqual(code.encode_text(), "0110")