{"id":18567131,"url":"https://github.com/vahidzee/zcode","last_synced_at":"2025-10-20T07:42:25.105Z","repository":{"id":62590972,"uuid":"417912015","full_name":"vahidzee/zcode","owner":"vahidzee","description":"My own Unicode compression algorithm","archived":false,"fork":false,"pushed_at":"2021-10-16T22:32:57.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-03T02:28:24.839Z","etag":null,"topics":["arithmetic-coding","compression","huffman-coding","lzw-compression","unicode"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vahidzee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-16T18:20:27.000Z","updated_at":"2021-10-20T12:02:36.000Z","dependencies_parsed_at":"2022-11-04T06:46:51.944Z","dependency_job_id":null,"html_url":"https://github.com/vahidzee/zcode","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahidzee%2Fzcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahidzee%2Fzcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahidzee%2Fzcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahidzee%2Fzcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vahidzee","download_url":"https://codeload.github.com/vahidzee/zcode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414503,"owners_count":22067272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arithmetic-coding","compression","huffman-coding","lzw-compression","unicode"],"created_at":"2024-11-06T22:25:32.513Z","updated_at":"2025-10-20T07:42:25.002Z","avatar_url":"https://github.com/vahidzee.png","language":"Python","readme":"# Zee Code\n\nZCode is a custom compression algorithm I originally developed for a competition held for the Spring 2019 Datastructures\nand Algorithms course of [Dr. Mahdi Safarnejad-Boroujeni](https://scholar.google.com/citations?user=TNfL9SIAAAAJ\u0026hl=en) at [Sharif University of Technology](http://ce.sharif.edu/), at which I became\nfirst-place. The code is pretty slow and has a lot of room for optimization, but it is pretty readable. It can be an\nexcellent educational resource for whoever is starting on compression algorithms.\n\nThe algorithm is a cocktail of classical compression algorithms mixed and served for Unicode documents. It hinges around\nthe [LZW algorithm](https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch) to create a finite size symbol dictionary; the results are then byte-coded into variable-length custom\nsymbols, which I call `zee` codes! Finally, the symbol table is truncated accordingly, and the compressed document is\nencoded into a byte stream.\n\n[Huffman trees](https://en.wikipedia.org/wiki/Huffman_coding) highly inspire `zee` codes, but because in normal texts, symbols are usually much more uniformly distributed\nthan the original geometrical (or exponential) distribution assumption for effective Huffman coding, the gains of using\nvariable-sized byte-codes both from an implementation and performance perspective outweighed bit Huffman encodings.\nResults may vary, but my tests showed a steady ~4-5x compression ratio on Farsi texts, which is pretty nice!\n\n## Installation\n\nZCode is available on pip, and only requires a 3.6 or higher python installation beforehand.\n\n```shell\npip install -U zcode\n```\n\n## Usage\n\nYou can run the algorithm for any `utf-8` encoded file using the `zcode` command. It will automatically decompress files\nending with a `.zee` extensions and compress others into `.zee` files, but you can always override the default behavior\nby providing optional arguments like:\n\n```shell\nzcode INPUTFILE [--output OUTPUT_FILE --action compress/decompress --symbol-size SYMBOL_SIZE --code-size CODE_SIZE]\n```\n\nThe `symbol-size` argument controls the algorithms' buffer size for processing symbols (in bytes). It is automatically\nset depending on your input file size but you can change it as you wish. `code-size` controls the maximum length for\ncoded bytes while encoding symbols (this equals to 2 by default and needs to be provided to the algorithm upon\ndecompression).\n\n## LICENSE\n\nMIT LICENSE, see [vahidzee/zcode/LICENSE](https://github.com/vahidzee/zcode/blob/main/LICENSE)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvahidzee%2Fzcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvahidzee%2Fzcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvahidzee%2Fzcode/lists"}