Ben Deutsch
and 1 contributors


text-lossy - lossy text compression via entropy reduction


text-lossy [-1|-2|-3|--filter <aa,bb,cc>|--paragraph] [file ...]

   - help                This help
   - version             Version of text-lossy
   - filter  aa,bb,cc    Add filters named 'aa', 'bb' and 'cc' to the process
                         This option can also be given more than once
   - available-filters   List of available filters
   - 1                   Preset 1: filter  'lower'
   - 2                   Preset 2: filters 'lower whitespace'
   - 3                   Preset 3: filters 'lower punctuation_sp whitespace'
   - 2l                  Same as preset 2, but uses 'whitespace_nl'
   - 3l                  Same as preset 3, but uses 'whitespace_nl'
   - paragraph           Read files in paragraph mode



Show this help.


Show the version of this program.


Add one ore more named filters to use for this run. For multiple filters, you can either separate the names with commas, or use the filter option several times.


Returns a list of currently available filters. These names can be passed to the filter option. See Text::Lossy(3pm) or supporting modules for information on the filters.

1, 2, 3

Various presets that choose from sensible filter lists. Generally, higher numbers will compress better.

2l, 3l

Similar to presets 2 and 3, except that newline characters on the end of lines remain newline characters. Most useful if you wish to pipe line-oriented data through text-lossy without causing it to buffer the entire input. May reduce compression efficiency.


Reads files, or STDIN, in paragraph oriented mode. In this mode, "paragraphs" are separated by one or more blank lines. Most useful in conjunction with the 2l or 3l presets, or the whitespace_nl filter: the output will contain one line per paragraph in the input.


This script is a straight-forward application of the Perl moduleL <Text::Lossy(3pm)|Text::Lossy> to STDIN or a set of files. Leave the list of files empty to read from STDIN. The results are printed to STDOUT.

Note that this module does not perform the actual compression itself, it merely changes the text so that it may be compressed better. You will most likely need to add some form of actual compression at the end, e.g.

  text-lossy -3 mytext.txt | gzip > mytext.txt.gz


None known so far.

Please report any bugs or feature requests to bug-text-lossy at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.




Ben Deutsch, <ben at>


Copyright 2013 Ben Deutsch.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.