Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ragaeeb/paragrafs/llms.txt
Use this file to discover all available pages before exploring further.
Welcome to Paragrafs
A lightweight TypeScript library designed to reconstruct paragraphs from AI transcriptions. It helps format unstructured text with appropriate paragraph breaks, handles timestamps for transcripts, and optimizes for readability.Key features
Paragrafs provides a comprehensive toolkit for working with AI-generated transcriptions:Segment reconstruction
Marks filler words, hints, and time gaps to create natural paragraph boundaries and merges overly short segments back into their predecessors
Timestamped formatting
Produces human-friendly transcripts with optional custom formatting callbacks and automatic timestamp rendering
Ground-truth alignment
Synchronizes AI generated tokens with human edited text using LCS-based alignment, interpolating timings for missing words
Selection helpers
Exposes utilities to find tokens for string queries or cursor selections, enabling rich text editors to jump to precise timestamps
Arabic-first hint system
Robust multi-word hint matching using normalization (diacritics/punctuation tolerant), plus hard boundary insertion via ALWAYS_BREAK
Auto-hint generation
Mines frequent repeated phrases from Token[] or Segment[] and returns sorted hint candidates for Arabic-heavy transcripts
Use cases
Paragrafs is perfect for:- Transcript formatting: Convert raw transcriptions into readable text
- Subtitle generation: Create properly formatted subtitles from audio transcriptions
- Document reconstruction: Rebuild properly formatted documents from extracted text
- Rich text editors: Enable timestamp-aware text editing with selection helpers
Getting started
Installation
Install Paragrafs via npm, yarn, pnpm, or bun
Quickstart
Get up and running with a working example
Built with modern tooling
- TypeScript: Full type safety and IntelliSense support
- ESM modules: Modern JavaScript module format
- Bun-native toolchain: Powered by tsdown for bundling and Biome for linting
- Zero dependencies: Lightweight and fast
Paragrafs is published to npm as
paragrafs and is available under the MIT License.