Dave Thomas wrote:
> 
> I want to implement a compression scheme for some text, and I want to
> implement it in pure Ruby.
> 
> I hacked up a simple LZW compressor (it was about 6 lines of Ruby) and 
> it works fine, but I believe that the Unisys patent prevents the use
> of this in commercial applications. I tried basic RLE and Huffman, but 
> the compression wasn't too good.
> 
> So could anyone recommend a scheme that's free for use, and which can
> be realistically decompressed in a handful of lines of Ruby?

bzip2 uses BWT (I don't recall what that stands for).
You can use BWT in combination with RLE which results in 
better compression as RLE alone.

I've implemented BWT some time ago in Ruby, but the whole program
including RLE was about 100 lines of code.

If you're interested I'll send you the sourcecode.
 

Another way could be to use what I call "bit table" compression,
where I generate an array of the most frequently used characters
and compress the whole data with a reduced bit-size (e.g. 5 bit). 


--
Michael Neumann