Giter Club home page Giter Club logo

human-zip's Introduction

human-zip

What?

Human-readable text compression by repeated introduction of abbreviations.

Why?

Is the book you want to read too long? Trying to save on printer paper? Or maybe you desperately need to fit your text to a page limit.

Perhaps you put the document through a compression utility such as zip, gzip, or 7-zip only to find that it outputs unreadable garbage?

human-zip is here to "help"!

How?

hzip.py treats the input document as a string over an alphabet of words (i.e. words are characters). The working principle is similar to Lempel-Ziv compression: common sequences of characters (phrases) are replaced with a new symbol (abbreviation) to compress the input. Unlike LZ compression, the output is human-readable and the "dictionary" is embedded into the text itself.

The script computes a suffix array and its longest common prefixes to find common repeated phrases. These phrases are scored based on length and number of occurrences, and an abbreviation is introduced for the top scoring phrase.

Try for example: python3 hzip.py never.txt

TODO

  • Fix abbreviation collisions
  • More efficient suffix array construction
  • Deal with overlaps
  • Handle common punctuation
  • Handle plural words

human-zip's People

Contributors

psaikko avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.