Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

string compression routine?

Posted on 1998-10-13
7
Medium Priority
?
463 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 400 total points
ID: 1342759
Thank you Thesan...   :-)

sorry, zac...   :-(

Regards, Madshi.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

721 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