{"id":50089420,"url":"https://github.com/browserbox/lzw-x","last_synced_at":"2026-05-22T22:06:54.586Z","repository":{"id":335128384,"uuid":"1144351164","full_name":"BrowserBox/LZW-X","owner":"BrowserBox","description":"Improving classic Lempel-Ziv-Welch with edit distance matching","archived":false,"fork":false,"pushed_at":"2026-01-28T17:34:29.000Z","size":1182,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"boss","last_synced_at":"2026-01-29T07:22:50.128Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BrowserBox.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-28T15:48:52.000Z","updated_at":"2026-01-28T17:57:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/BrowserBox/LZW-X","commit_stats":null,"previous_names":["do-say-go/lzw-x"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/BrowserBox/LZW-X","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrowserBox%2FLZW-X","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrowserBox%2FLZW-X/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrowserBox%2FLZW-X/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrowserBox%2FLZW-X/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BrowserBox","download_url":"https://codeload.github.com/BrowserBox/LZW-X/tar.gz/refs/heads/boss","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrowserBox%2FLZW-X/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33372739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-22T21:56:13.512Z","status":"ssl_error","status_checked_at":"2026-05-22T21:56:10.769Z","response_time":265,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-05-22T22:06:53.458Z","updated_at":"2026-05-22T22:06:54.579Z","avatar_url":"https://github.com/BrowserBox.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LZW-X: Experimental Fuzzy-Matching Compression\n\nLZW-X is a proof-of-concept compression algorithm that explores breaking the \"exact-match\" constraint of classic LZW. By integrating fuzzy dictionary lookups (bioinformatics-style alignment) and edit-distance modeling, LZW-X attempts to discover hidden patterns in data where traditional compressors see only noise.\n\n## 🧪 The Hypothesis\n\nClassic LZW (used in GIF and Unix `compress`) relies on finding exact repeating prefixes. If a sequence changes by just one character, the dictionary match breaks.\n\n**The LZW-X approach:** Instead of giving up on a near-match, LZW-X attempts to encode the *difference*. It uses a **Neighbor Graph** to find dictionary entries that are \"close enough\" and emits a compact edit script to patch the match.\n\n**Note:** This is currently a research prototype. It trades significant CPU cycles (approx 8-10x slower than LZW) for marginal compression ratio gains in specific \"noisy\" datasets.\n\n### ✨ Key Features\n\n- **Fuzzy Dictionary Lookups**: Leverages Levenshtein distance to find approximate matches.\n- **Neighbor Graph Optimization**: Local search strategy to mitigate the cost of dictionary scanning.\n- **Arithmetic Coding**: Two-pass entropy encoding for both dictionary codes and edit scripts.\n- **Target Use Case**: High-redundancy data with mutations, such as DNA sequences or repetitive logs with timestamps.\n\n## 📈 Performance Benchmarks\n\nCurrent benchmarks highlight the trade-offs of this approach. While LZW-X can squeeze out more entropy than standard LZW in specific files (like `karamazov.txt`), the gains are currently small (\u003c1%) compared to the computational cost.\n\n| File | Dict Size | LZW Ratio | LZW-X Ratio | Winner | Margin (%) |\n| :--- | :--- | :--- | :--- | :--- | :--- |\n| **karamazov.txt** | 16K | 0.4598 | **0.4569** | 🏆 **LZW-X** | 0.63% |\n|  | 30K | 0.4884 | **0.4884** | 🏆 **LZW-X** | 0.02% |\n|  | 38K | **0.5093** | 0.5096 | 🏆 **LZW** | 0.05% |\n|  | 50K | 0.5416 | **0.5413** | 🏆 **LZW-X** | 0.05% |\n| **megavirus.fasta** | 30K | 0.4237 | **0.4232** | 🏆 **LZW-X** | 0.12% |\n| **std_image.h** | 30K | 0.9164 | **0.9152** | 🏆 **LZW-X** | 0.13% |\n\n*Note: Ratios \u003e 1.0 indicate the file grew (header overhead).*\n\n## 🧠 How it Works\n\n1. **Exact Match Search**: Starts with standard LZW prefix matching.\n2. **Neighbor Search**: If the match is too short, LZW-X pivots to the **Neighbor Graph**—a dynamic structure linking \"edit neighbors\".\n3. **Edit Scripting**: If a superior approximate match is found, it encodes the dictionary code plus a minimal set of edits (Substitutions, Insertions, Deletions).\n4. **Entropy Coding**: The resulting stream is piped through a two-pass arithmetic encoder.\n\n## 🛠 Usage\n\nRequires Python 3.8+.\n\n```bash\ngit clone https://github.com/BrowserBox/LZW-X.git\ncd LZW-X\n\n# Compress\n./lzwx -v input.txt output.lzwx\n\n# Decompress\n./unlzwx output.lzwx input_restored.txt\n```\n\n## Credits \u0026 Implementation\n\n*   **Concept:** Adapted from research on sequence alignment applied to compression (circa 2013).\n*   **Implementation:** This implementation was realized with the assistance of LLMs (Claude, etc), allowing for rapid prototyping of the arithemtic encoding logic etc.\n*   **License:** GNU AGPLv3.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserbox%2Flzw-x","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrowserbox%2Flzw-x","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserbox%2Flzw-x/lists"}