Get up and running with Paragrafs in just a few minutes. This guide walks you through processing your first transcription tokens into formatted paragraphs.
Here’s a simple example to get started with Paragrafs:
import { estimateSegmentFromToken, mapSegmentsIntoFormattedSegments} from 'paragrafs';// Example token from transcriptionconst token = { start: 0, end: 5, text: 'This is a sample text. It should be properly segmented.',};// Estimate segment with word-level tokensconst segment = estimateSegmentFromToken(token);// Format the segmentconst formattedSegments = mapSegmentsIntoFormattedSegments([segment]);console.log(formattedSegments[0].text);// Output: "This is a sample text. It should be properly segmented."
// Process the segmentsconst combinedSegments = markAndCombineSegments(segments, options);const formattedSegments = mapSegmentsIntoFormattedSegments(combinedSegments);// Get timestamped transcriptconst transcript = formatSegmentsToTimestampedTranscript(combinedSegments, 10);console.log(transcript);// Output:// 0:00: The quick brown fox!// 0:08: Jumps right over the