Thread: IDEA: Text File (De)Compressor

  1. #1
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490

    IDEA: Text File (De)Compressor

    It is quite easy yo program a normal compression program for text..

  2. #2
    Registered User Dcower's Avatar
    Join Date
    Aug 2002
    Posts
    8

    Question

    Any examples? How would you create a text file compresser? I have some ideas...

  3. #3
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    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

  4. #4
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    that's a horrid example...it doesn't even compress...it just makes things bigger...lol...

  5. #5
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    as i said before the compression goes up the bigger the compressed item.

  6. #6
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    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::

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  4. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 03:58 PM
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 07:35 PM