Skip to content

superdwayne/text-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Textese Compressor

Transform text into textese abbreviations to reduce token usage in AI prompts

MIT License Open Source

๐Ÿš€ Features

  • Textese Compression: Converts text into aggressive textese abbreviations
  • Token Reduction: Significantly reduces text length to save tokens in AI API calls
  • Public API: Open REST API endpoint available on Vercel
  • Serverless: Fast, scalable serverless function
  • Modern UI: Clean, shadcn-inspired React interface
  • No Authentication: Free to use, no API keys required

๐Ÿ“– What is Textese?

Textese is a form of written language that uses abbreviations and number substitutions to compress text, similar to SMS language. Examples:

  • great โ†’ gr8
  • mate โ†’ m8
  • you โ†’ u
  • are โ†’ r
  • today โ†’ 2day
  • tonight โ†’ 2nite
  • laugh out loud โ†’ lol
  • oh my god โ†’ omg
  • to be honest โ†’ tbh

๐ŸŽฏ Use Cases

  • AI Prompt Optimization: Reduce token usage in AI API calls
  • Text Compression: Compress long messages while maintaining readability
  • Cost Savings: Lower costs when using token-based AI services
  • Character Limits: Fit more content in character-limited fields

๐Ÿš€ Quick Start

Using the API

Endpoint: https://sms-six-mocha.vercel.app/api/compress

Tip: Append ?format=toon to receive the response in TOON format for improved token efficiency.

curl -X POST https://sms-six-mocha.vercel.app/api/compress \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello, how are you doing today?"}'

Response:

{
  "original": "Hello, how are you doing today?",
  "compressed": "Hi, how r u doin 2day?",
  "reduction": "25%"
}

JavaScript Example

const response = await fetch('https://sms-six-mocha.vercel.app/api/compress?format=toon', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ text: 'Hello, how are you doing today?' })
});

const toon = await response.text();
console.log(toon);

Python Example

import requests

response = requests.post(
    'https://sms-six-mocha.vercel.app/api/compress',
    json={'text': 'Hello, how are you doing today?'}
)

print(response.json()['compressed'])  # "Hi, how r u doin 2day?"

๐Ÿ› ๏ธ Local Development

Prerequisites

  • Node.js 18+
  • npm or yarn

Setup

  1. Clone the repository:
git clone https://github.com/yourusername/textese-compressor.git
cd textese-compressor
  1. Install dependencies:
# Frontend
cd frontend
npm install

# Backend (optional, for local testing)
cd ../backend
npm install
  1. Run the frontend:
cd frontend
npm run dev
  1. Run the backend locally (optional):
cd backend
npm start

๐Ÿ“ฆ Deployment

Deploy to Vercel

  1. Install Vercel CLI:
npm i -g vercel
  1. Login and deploy:
vercel login
vercel --prod

See DEPLOYMENT.md for detailed instructions.

๐Ÿ“ Project Structure

textese-compressor/
โ”œโ”€โ”€ api/                    # Vercel serverless functions
โ”‚   โ”œโ”€โ”€ compress.js         # Main compression endpoint
โ”‚   โ””โ”€โ”€ index.js            # API info endpoint
โ”œโ”€โ”€ frontend/               # React application
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/    # React components
โ”‚   โ”‚   โ”œโ”€โ”€ services/      # API client
โ”‚   โ”‚   โ””โ”€โ”€ App.jsx        # Main app component
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ lib/                    # Shared utilities
โ”‚   โ””โ”€โ”€ compressor.js      # Compression logic
โ”œโ”€โ”€ backend/                # Express server (optional)
โ”œโ”€โ”€ .github/                # GitHub templates
โ”œโ”€โ”€ LICENSE                 # MIT License
โ”œโ”€โ”€ CONTRIBUTING.md         # Contribution guidelines
โ””โ”€โ”€ README.md              # This file

๐Ÿค Contributing

Contributions are welcome! Please read our Contributing Guide for details on:

  • Code of conduct
  • How to submit bug reports
  • How to suggest features
  • How to submit pull requests

Adding New Abbreviations

To add new textese abbreviations, edit lib/compressor.js:

const abbreviations = {
  // Add your abbreviations here (longest first)
  'your phrase': 'abbrev',
  // ...
};

๐Ÿ“ API Documentation

POST /api/compress

Compresses text into textese format.

Request:

{
  "text": "Your text here"
}

Response:

{
  "original": "Your text here",
  "compressed": "Ur txt hr",
  "reduction": "30%"
}

Status Codes:

  • 200 - Success
  • 400 - Bad Request (invalid input)
  • 405 - Method Not Allowed
  • 500 - Internal Server Error

GET /api/compress

Returns API information and usage examples.

๐Ÿ› Known Issues

  • Some abbreviations may not compress as expected
  • Very short words are preserved to maintain readability

๐Ÿ”ฎ Roadmap

  • Add more abbreviation patterns
  • Support for multiple languages
  • Compression level options (aggressive vs moderate)
  • Batch compression endpoint
  • Compression statistics and analytics

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

โญ Star History

If you find this project useful, please consider giving it a star!


Made with โค๏ธ by the open source community

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors