PDA

View Full Version : IDEA: Text File (De)Compressor



ygfperson
08-12-2002, 11:27 PM
It is quite easy yo program a normal compression program for text..

Dcower
08-23-2002, 12:19 AM
Any examples?:D How would you create a text file compresser? I have some ideas...

ygfperson
08-23-2002, 08:25 PM
a text file compressor is a lossless compressor where some aspects of its algorithm are altered in favor of text compression. Some aspects of text:
text uses a smaller character set than the 256 choices availiable.
text often has words or phrases that repeat, allowing more compression

where data can be random, or can vary greatly from data type to data type, text is pretty much uniform.

i don't have any examples with me... here's an example of text substitution in text compression:


it's not what your country can do for you it's what you can do for your country
assign each word to a number


it's 1
not 2
what 3
your 4
country 5
can 6
do 7
for 8
you 9

then you recreate the message:


1 2 3 4 5 6 7 8 9 1 3 9 6 7 8 4 5

this message is more compressed. of course, you'll have to attach the dictionary to the file, and that costs a lot of bytes. but as the message gets longer, the efficiency of th ecompression gets higher.

the internet can show you a better explanation

-KEN-
08-23-2002, 09:36 PM
that's a horrid example...it doesn't even compress...it just makes things bigger...lol...

ygfperson
08-26-2002, 09:28 PM
as i said before the compression goes up the bigger the compressed item.

-KEN-
08-30-2002, 01:46 PM
ARGX! We lots my big ol' post explaining why that was a bad compression scheme and citing points to make it better...

::goes to shoot himself::