Metadata-Version: 2.4
Name: tokenshrink-ai
Version: 0.1.1
Summary: A lightweight Python package for prompt compression and token optimization.
Author: Andy Geng
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# ⚡ TokenShrink

![Run Unit Tests](https://github.com/YOUR_GITHUB_USERNAME/TokenShrink/actions/workflows/test.yml/badge.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

> A lightweight Python library for prompt compression and token optimization—reduce LLM input costs by 30-50% without sacrificing context.

## Features
- **Prompt Pruning:** Automatically strips conversational fluff ("please", "kindly") and collapses unnecessary whitespace.
- **Data Serialization:** Converts heavy JSON payloads into token-efficient tabular representations.
- **Zero Overhead:** Blazing fast execution using pure Python regular expressions.

## Quickstart

```bash
pip install -e .

from token_shrink import prune_prompt, compress_struct

# Prune filler words
raw_prompt = "Could you please kindly analyze this data?"
clean_prompt = prune_prompt(raw_prompt)
print(clean_prompt)  # "analyze this data"

# Compress structured data
data = [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]
compact = compress_struct(data)
print(compact)
# [2]{id,name}:
# 1,Alice
# 2,Bob

pytest
