{ "info": { "author": "Nick Timkovich", "author_email": "npt@u.northwestern.edu", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3" ], "description": "huffman\n=======\n\nGenerate Huffman codebooks! `Huffman codes`_ are the optimal way to compress individual symbols into a binary sequence that can be unambiguously decoded without inter-symbol separators (it is \"`prefix-free`_\").\n\nProvided an iterable of 2-tuples in ``(symbol, weight)`` format, generate a Huffman codebook, returned as a dictionary in ``{symbol: code, ...}`` format.\n\n::\n\n >>> huffman.codebook([('A', 2), ('B', 4), ('C', 1), ('D', 1))\n {'A': '10', 'B': '0', 'C': '110', 'D': '111'}\n\nIf you have an iterable of symbols, the ``collections.Counter`` is a handy way to tally them up.\n\n::\n\n >>> huffman.codebook(collections.Counter('man the stand banana man').items())\n {' ': '111',\n 'a': '10',\n 'b': '0100',\n 'd': '0110',\n 'e': '11010',\n 'h': '0101',\n 'm': '1100',\n 'n': '00',\n 's': '11011',\n 't': '0111'}\n\n\n.. _Huffman codes: https://en.wikipedia.org/wiki/Huffman_coding\n.. _prefix-free: https://en.wikipedia.org/wiki/Prefix_code\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nicktimko/huffman", "keywords": "encoding huffman compression binary", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "huffman", "package_url": "https://pypi.org/project/huffman/", "platform": "", "project_url": "https://pypi.org/project/huffman/", "project_urls": { "Homepage": "https://github.com/nicktimko/huffman" }, "release_url": "https://pypi.org/project/huffman/0.1.2/", "requires_dist": null, "requires_python": "", "summary": "Generate Huffman codebooks", "version": "0.1.2" }, "last_serial": 2533361, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e8794995855e2b388ed4fdffdaca04b0", "sha256": "13c359583e946b9a20cade5e904f18eaaa569cf79d758db35d7e2bd4f555f597" }, "downloads": -1, "filename": "huffman-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e8794995855e2b388ed4fdffdaca04b0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 2812, "upload_time": "2016-04-07T22:54:19", "url": "https://files.pythonhosted.org/packages/62/ed/4376e1bcd183f223735d0612739c044bad2a60b2fbc8bfe711b71ea993ee/huffman-0.1.0-py2.py3-none-any.whl" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "06c4f1387b129a780a4304b6ff353673", "sha256": "35234336f75b8ade2dbdd646c04d089ce79a0cc41724e02279103be864891a19" }, "downloads": -1, "filename": "huffman-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "06c4f1387b129a780a4304b6ff353673", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4611, "upload_time": "2016-12-21T20:05:39", "url": "https://files.pythonhosted.org/packages/c5/72/99cf86630e26a02f2ee6ab649465fce7af7723635902cd79af91f6cc60e5/huffman-0.1.2-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "06c4f1387b129a780a4304b6ff353673", "sha256": "35234336f75b8ade2dbdd646c04d089ce79a0cc41724e02279103be864891a19" }, "downloads": -1, "filename": "huffman-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "06c4f1387b129a780a4304b6ff353673", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4611, "upload_time": "2016-12-21T20:05:39", "url": "https://files.pythonhosted.org/packages/c5/72/99cf86630e26a02f2ee6ab649465fce7af7723635902cd79af91f6cc60e5/huffman-0.1.2-py2.py3-none-any.whl" } ] }