ChopText is a smart text segmentation tool designed to split long text into smaller chunks based on a maximum character limit, while preserving sentence structure and paragraph integrity. Built with modern web technologies for optimal performance and user experience.
- Smart Splitting: Intelligent segmentation that respects punctuation (.?!;), commas, and spaces.
- Customizable Length: Set your preferred maximum characters per chunk (N).
- Paragraph Handling: Choose to split by single newlines or standard double-newline paragraphs.
- Internationalization: Fully localized for English and Chinese (Simplified).
- Dark Mode: Supports system, light, and dark themes.
- Privacy Focused: All processing happens locally in your browser.
- Export: Copy to clipboard or download as .txt.
- Framework: React + TypeScript + Vite
- UI Library: shadcn/ui + Tailwind CSS
- State/i18n: React Hooks + react-i18next
- Testing: Vitest
- Tooling: ESLint, Prettier, PostCSS
- Node.js 18+
- pnpm
-
Clone the repository:
git clone https://github.com/halfsweet/ChopText.git cd ChopText -
Install dependencies:
pnpm install
-
Start development server:
pnpm dev
-
Build for production:
pnpm build
-
Run tests:
pnpm test
This project is configured to automatically deploy to GitHub Pages via GitHub Actions.
- Go to your repository Settings -> Pages.
- Select GitHub Actions as the source.
- Push your code to the
mainbranch. - The workflow will automatically build and deploy the site.
Note: The vite.config.ts is configured with base: "/ChopText/". If your repository name is different, please update the base path in vite.config.ts.
The ChopText algorithm prioritizes cutting text at natural boundaries:
- Strong punctuation (running sentence endings like
.,?,!,。). - Weak punctuation (clauses like
,,,). - Spaces (for Western languages).
- Forced hard cut (if no boundaries found within the limit).
It normalizes CJK and mixed text handling by checking for standard Unicode punctuation marks.
Apache License 2.0