Skip to main content

A learning-augmented text compression engine in C++20

Project description

moezip

License: MIT C++20 Platform

A learning-augmented, high-efficiency text compression engine written in C++20. moezip combines a Mixture of Experts (MoE) predictive state router, 32-bit Asymmetric Numeral Systems (rANS) arithmetic coding, and LZ back-referencing.

Standard dictionary-less compressors (like raw Zstandard or Gzip) incur frame-header inflation on short inputs, often expanding small text strings. moezip embeds pre-trained vocabulary tables and transition matrices directly into the compiled library or executable, enabling instant pattern prediction with zero metadata overhead.


Documentation

Full technical documentation, build guides, and API specifications are hosted on the moezip GitHub Wiki:

  • Architecture & Design: Internal pipeline, tokenization, 32x32 MoE router, and make.py string-literal generator.
  • Building & Compilation: CMake build guides for Windows (MSVC) and Linux (GCC/Clang).
  • CLI Usage & Training: Command reference, stream piping, and training domain-specific matrices.
  • API Reference: Documentation for Python (import moezip), C-API dynamic libraries, and native C++ headers.
  • Performance & Benchmarks: Detailed space savings and speed metrics across micro-strings (< 500 B) and medium documents.

Key Highlights

  • Zero Warm-Up Penalty: Compresses small text payloads and chat messages (< 500 bytes) without header bloat.
  • Self-Contained Portability: Default vocabulary (words_final.txt) and router matrix (router_stateless_v4.json) compile directly into the binary. No external asset files are required at runtime.
  • Multi-Target Compilation: Single CMake build produces standalone CLI executables, C-API dynamic libraries (.dll / .so), or native PyBind11 Python extension modules (.pyd / .so).
  • Domain Trainable: Built-in training mode (moezip train) optimizes state transition weights for specialized corpora (code, medical, legal).

Quick Start

Python Extension (import moezip)

import moezip

# Compress string in memory using embedded assets
compressed = moezip.compress("Hello world, compress this text!")
restored = moezip.decompress(compressed)

assert restored == "Hello world, compress this text!"

Command Line Interface

# Compress text file
moezip compress input.txt -o archive.moe

# Decompress back to original text
moezip decompress archive.moe -o restored.txt

Performance Snapshot

Across 532 cumulative bytes of micro-string test samples:

  • moezip: Reduced size to 247 bytes (53.6% space savings).
  • Raw Zstandard (L3): Reduced size to 456 bytes (14.3% space savings).

For detailed test data and medium-clip benchmarks, see the Performance & Benchmarks Wiki page.


Compiled Artifacts

Platform Executable Shared Library (C-API) Python Module
Windows (MSVC) moezip.exe moezip.dll / moezip.lib moezip.pyd
Linux (GCC / Clang) moezip libmoezip.so moezip.so

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moezip-1.0.0.tar.gz (534.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moezip-1.0.0-cp311-cp311-win_amd64.whl (364.0 kB view details)

Uploaded CPython 3.11Windows x86-64

File details

Details for the file moezip-1.0.0.tar.gz.

File metadata

  • Download URL: moezip-1.0.0.tar.gz
  • Upload date:
  • Size: 534.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for moezip-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0e132e8423e0dd6ebbbcf3b8a9155e5ab61d23858dc0421b9aca120a037a5799
MD5 139a95382dedcce0557ed24bf8719a39
BLAKE2b-256 fb667504f6d82d4b2494c26e775742a07beb354f68443db5837f8fa54cca18be

See more details on using hashes here.

File details

Details for the file moezip-1.0.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: moezip-1.0.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 364.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for moezip-1.0.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b2dce71d4e0e5223e41d0d641ed149d88aba6b036ddf5933057a89101dbae3ed
MD5 56b7e49890db32f9930721da57234be8
BLAKE2b-256 6d4210dba236ac2e1c504398aefbe065bfc29043f5086a018d07602c98d55cdd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page