An open API service indexing awesome lists of open source software.

https://github.com/dnafication/llm-textfix

Sanitize LLM output by detecting and replacing 25+ problematic characters
https://github.com/dnafication/llm-textfix

ai character-cleaner llm react text-processing typescript unicode web-app

Last synced: about 1 month ago
JSON representation

Sanitize LLM output by detecting and replacing 25+ problematic characters

Awesome Lists containing this project

README

          

# LLM TextFix

**Sanitize LLM output by detecting and replacing 25+ problematic characters**

A modern web application that helps developers and content creators clean up text generated by Large Language Models (LLMs) by detecting and replacing problematic Unicode characters that can break workflows, cause formatting issues, or create copy-paste headaches.

## โœจ Features

- **๐Ÿ” Smart Detection**: Automatically highlights 25+ types of problematic characters
- **๐ŸŽจ Visual Highlighting**: Color-coded highlighting by character category
- **โšก One-Click Replacement**: Convert all problematic characters to standard equivalents
- **๐Ÿ“‹ Copy to Clipboard**: Easy copying of cleaned text
- **๐Ÿ“ฑ Mobile Responsive**: Works seamlessly on all screen sizes
- **๐Ÿš€ Fast & Lightweight**: Built with React and Vite for optimal performance
- **๐Ÿ›ก๏ธ Safe HTML Handling**: Prevents XSS by properly escaping HTML content

## ๐ŸŽฏ Supported Character Types

### Smart Quotes (๐ŸŸก Amber)
- Left/Right double quotation marks (" ")
- Left/Right single quotation marks (' ')
- Low quotation marks (โ€š โ€ž)
- Angle quotation marks (ยซ ยป โ€น โ€บ)

### Dashes & Hyphens (๐ŸŸฃ Purple)
- Em dash (โ€”) โ†’ Standard hyphen (-)
- En dash (โ€“) โ†’ Standard hyphen (-)
- Various Unicode hyphens (โ€ โ€‘ โ€’ โ€•)

### Invisible Spaces (๐Ÿ”ด Red)
- Non-breaking space
- Thin space, Hair space
- En space, Em space
- Narrow no-break space
- Line/Paragraph separators
- Ideographic space

### Special Punctuation (๐ŸŸข Green)
- Horizontal ellipsis (โ€ฆ) โ†’ Three dots (...)

## ๐Ÿš€ Getting Started

### Prerequisites
- Node.js 18+
- npm or yarn

### Installation

1. **Install dependencies**
```bash
npm install
```

2. **Start development server**
```bash
npm run dev
```

3. **Open in browser**
Navigate to `http://localhost:5173`

### Building for Production

```bash
npm run build
npm run preview
```

## ๐ŸŽฎ Usage

1. **Input Text**: Paste your LLM-generated text into the textarea
2. **View Highlights**: Problematic characters are automatically highlighted with tooltips
3. **Replace Characters**: Click "Replace" to convert all problematic characters
4. **Copy Result**: Use "Copy" to copy the cleaned text to your clipboard

## ๐Ÿ› ๏ธ Tech Stack

- **Frontend**: React, TypeScript
- **Styling**: Tailwind CSS
- **Build Tool**: Vite
- **Development**: ESLint, PostCSS, Autoprefixer

## ๐Ÿค Contributing

Contributions are welcome! Here are some ways you can help:

1. **Add new character types**: Expand the `PROBLEMATIC_CHARS` object
2. **Improve mobile experience**: Enhance responsive design
3. **Add features**: Implement new functionality like regex patterns
4. **Fix bugs**: Report and fix issues
5. **Improve documentation**: Enhance README or add code comments

### Development Workflow

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes
4. Commit your changes (`git commit -m 'Add amazing feature'`)
5. Push to the branch (`git push origin feature/amazing-feature`)
6. Open a Pull Request

## ๐Ÿ› Common Issues

### Characters not highlighting?
- Ensure the character is included in the `PROBLEMATIC_CHARS` object in `App.tsx`
- Check if the character category has proper CSS styling

### Tailwind styles not working?
- Verify `postcss.config.js` exists
- Check that Tailwind directives are in `src/index.css`
- Restart the development server

## ๐Ÿ™ Acknowledgments

- Inspired by the common copy-paste issues with LLM output

---

Made with โค๏ธ for developers dealing with LLM output formatting issues.