Practical and Effective Re-Pair Compression
Abstract
Re-Pair is an efficient grammar compressor that operates by recursively replacing high-frequency character pairs with new grammar symbols. The most space-efficient linear-time algorithm computing Re-Pair uses words on top of the re-writable text (of length and stored in words), for any constant ; in practice however, this solution uses complex sub-procedures preventing it from being practical. In this paper, we present an implementation of the above-mentioned result making use of more practical solutions; our tool further improves the working space to words (text included), for some small constant . As a second contribution, we focus on compact representations of the output grammar. The lower bound for storing a grammar with rules is bits, and the most efficient encoding algorithm in the literature uses at most bits and runs in time. We describe a linear-time heuristic maximizing the compressibility of the output Re-Pair grammar. On real datasets, our grammar encoding uses---on average---only more bits than the information-theoretic minimum. In half of the tested cases, our compressor improves the output size of 7-Zip with maximum compression rate turned on.
Cite
@article{arxiv.1704.08558,
title = {Practical and Effective Re-Pair Compression},
author = {Philip Bille and Inge Li Gørtz and Nicola Prezza},
journal= {arXiv preprint arXiv:1704.08558},
year = {2017}
}