Solved

string compression routine?

Posted on 1998-10-13
7
458 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses
Course of the Month8 days, 15 hours left to enroll

615 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