Textpress
AI-powered text compression tool that condenses content while preserving meaning across multiple formats.
Install / Use
/learn @sliday/TextpressREADME
Textpress: AI Text Copy Compressor
Textpress is a Python script that compresses text content within files using AI models. It processes files like JavaScript, JSON, YAML, etc., extracts text strings, and compresses them to be more concise while retaining their original meaning. The script is interactive and allows customization to tailor the compression process to your needs.
How It Works
Textpress follows these steps:
- File Processing: "Reads" (using AI) the input file and detects its format (JSON, YAML, JS, etc).
- String Extraction: Extracts text strings suitable for compression. No need to compress parameters' names, for example.
- AI Compression: Uses an AI model to generate compressed versions of the strings while preserving their meaning.
- Content Replacement: Replaces the original strings with the compressed ones in the content.
- Output Generation: Writes the compressed content to an output file.
- Statistics Display: Provides compression statistics and sample comparisons.
Available Options
- AI Model Selection:
- Claude (default)
- ChatGPT
- Llama (for local processing)
- Creativity Level (1-5):
- Adjusts the AI's creativity and variability.
- Higher levels increase creativity but may reduce consistency.
- Compression Level (1-5):
- Defines how aggressively to compress text.
- Higher levels attempt more aggressive compression.
- Field of Expertise:
- Tailors the compression to use language appropriate for a specific domain (e.g., psychology, medicine).
- Style Guidelines:
- Provide instructions like "formal", "technical", or "use metaphors".
- Emoji Inclusion:
- Choose to include emojis for added expressiveness.
Usage
-
Run the script:
python textpress.py <input_file> [output_file]<input_file>: Path to the file you want to compress.[output_file](optional): Path for the output file. Defaults to<input_name>_output<extension>.
-
Follow the interactive prompts:
- AI Model: Choose between available AI models.
- Creativity Level: Enter a value between 1 (least creative) to 5 (most creative).
- Compression Level: Set the aggressiveness of compression attempts.
- Field of Expertise: Specify the domain for tailored language.
- Style Guidelines: (Optional) Add specific style preferences.
- Emoji Usage: Decide whether to include emojis in the compressed text.
-
Review the Output:
- The script processes the file and saves the compressed content to the output file.
- Displays compression statistics and sample comparisons.
Example
Running the script with an input JavaScript file (output file name is optional):
python textpress.py input.js [output.js]
- If
output.jsis not provided, the script defaults toinput_output.js.
Interactive Prompts Example:
- Choose AI model: Press Enter to use the default (Claude).
- Enter creativity level (1-5):
3 - Enter compression level (1-5):
3 - Enter the field:
psychology - Style guide:
formal - Want emojis in compressed text? (y/N):
N
Result:
- Processes
input.jsand saves the compressed content inoutput.js(if specified) orinput_output.jsby default. - Displays compression statistics and sample comparisons in the terminal.
Installation
-
Install required packages:
pip install -r requirements.txtAlternatively:
pip install json5 ell colorama pyyaml esprima
Star History
<a href="https://star-history.com/#sliday/textpress&Date"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=sliday/textpress&type=Date&theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=sliday/textpress&type=Date" /> <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=sliday/textpress&type=Date" /> </picture> </a>Notes
- AI Model Credentials:
- Ensure the
elllibrary is configured with necessary credentials.
- Ensure the
- Review Output:
- Always review the compressed content to ensure accuracy.
- Compatibility:
- Supports multiple file formats; some complex structures may have limitations.
License
This project is licensed under the MIT License.
Related Skills
qqbot-channel
344.4kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
99.9k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
344.4kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
project-overview
FlightPHP Skeleton Project Instructions This document provides guidelines and best practices for structuring and developing a project using the FlightPHP framework. Instructions for AI Coding A
