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.1.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.1-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.1.tar.gz.

File metadata

  • Download URL: moezip-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 4366632859a3c25c9ffdcc0c5bc17c6850bf6248391fbeaaf65a75c668ecf955
MD5 788c26cde8d53cf8a9c6a529a3489297
BLAKE2b-256 bf701f988c646f01efeec5c62b7d64839c9793a280b1bc3d5f597f721f36428f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: moezip-1.0.1-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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8e156a85d4cd4607744c7609e41f1bf359e21eed90c6f4cdbea63a0c1460dcc5
MD5 65161008adee33d71570118f1dd00056
BLAKE2b-256 09915bb7c3acf430617071395af661e3916aac75856b327e93d95d6b640a4bf8

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