0

I would love to use PPMd compression (https://en.wikipedia.org/wiki/Prediction_by_partial_matching) in a Python script that saves log files (since PPMD is amazing at compressing text/log files).

However, I can't seem to find any library that implements this. I have found a gzip library, but this is slower and worse than PPMd for my situation.

If there is no library for PPMd compression, how would I go about implementing it?

Cherona
  • 758
  • 2
  • 10
  • 27

1 Answers1

0

Python core offers some compression algorithms, but PPMd is not supported yet. [1]

You could anyhow call eg. 7zip with the subprocess module. Here is an example on how to use 7zip with PPMd in the command line:

7z a -m0=PPMd archive.7z text.txt

You also might want to have a look at this answer Mimic 7zip with python where two Python libraries for using 7zip are mentioned, but the first one only works on Linux and the other only on Windows.

Night Train
  • 2,383
  • 3
  • 18
  • 35
  • I just saw this blogpost, where somebody posted hist implementation of PPMd in Python: https://encode.su/threads/1583-diz-py-release – Night Train Feb 17 '20 at 09:26