Solved

string compression routine?

Posted on 1998-10-13
7
441 Views
Last Modified: 2010-05-18
Hi everybody!

I'm looking for a set of routines (not necessarily a component - actually: preferably not a component) than can compress strings to a reasonable size (i.e. smaller than 50% for plain text)

Quite a while ago, I used to have a library called "HyperString", but
a) it only compressed BY 35% in stream-compression
b) the block compression compressed by rougly 45%, but was cumbersome to use (block length limited to 64K)

Any ideas? I am NOT looking for a component that will create ZIP-files for me!! For specific reasons, I want to compress only certain parts of a file, the rest must be accessible without decompression (header-information)

Would be nice if it was freeware or at least cheap since I won't earn money with my program...

Thanks for your help!
0
Comment
Question by:Thesan
7 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1342753
Look at paszlib. Perhaps it's what you need.
"http://www.tu-chemnitz.de/~nomssi/paszlib.html"

Regards, Madshi.
0
 
LVL 10

Expert Comment

by:Jacco
ID: 1342754
Are there any strange characters in the string? I mean is the character range used in the strings 0..255 or something like 'A'..'Z','a'..'z','0'..'9','+-=,.:;"/?!@#$%^&*()_+'?

Regards Jacco
0
 
LVL 4

Expert Comment

by:erajoj
ID: 1342755
Hi,
What sizes of strings are we talking about here?
Using Huffman on small strings <256 chars doesn't guarantee <50% compression. Compression is not an exact science. The compression never gets better than the compressee.
Using a lookup table with entries of the most common words is an approach. However, it needs quite a large table to be efficient.
Provide more info!

/// John
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Expert Comment

by:zac
ID: 1342756
If you have Delphi 3 or above then you already have the solution in the info directory on the CD.  The ZLIB library is a c implementation of the LZ77 algorithm (used by zip, gzip etc).

It implements its compression as a stream and therefore should be perfect for you use.  It is free, even includes source code and the author even provided pascal interfaces to it....

When I have used it in the past I have got greater than 50% compression on largish text files > 20K (ish) but it very much depends on the data you are compressing

I hope this helps...

Zac
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1342757
Hello zac,

seems, that you didn't read my comment!?    :-(
0
 

Author Comment

by:Thesan
ID: 1342758
And we have a winner!!
To be fair, it's Madshi because he recommended the routines first.

They are indeed quite nice. The interface could be more sophisticated, but that's not even bad - no unnecessary overhead, just resonably fast and efficient block compression routines without limitation to the length (as far as I can tell - 500K were no problem).

Thanks to zac for pointing out that these routines are included with Delphi. However, those routines have a "stream-interface" that might be a bit easier to use but is more overhead and actually makes things more complicated in my specific case.

For blocks of 50 K with about 80% plain text, I get around 65% compression.

Thanks guys and sorry for the slow reply, but I didn't have time to figure out if the routines would work for me!

Madshi: Post an answer to get your points :-))
0
 
LVL 20

Accepted Solution

by:
Madshi earned 100 total points
ID: 1342759
Thank you Thesan...   :-)

sorry, zac...   :-(

Regards, Madshi.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now