Skip to content

Commit

Permalink
concat segments with newlines by default
Browse files Browse the repository at this point in the history
  • Loading branch information
bscholer committed Feb 9, 2024
1 parent 94fe51e commit 2f8a5d9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/transcribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,11 @@ export class TranscriptionEngine {
text: segment.text
}));
return this.segmentsToTimestampedString(segments, this.settings.timestampFormat);
} else if (preprocessed.segments) {
// Concatenate all segments into a single string if no timestamps are required
return preprocessed.segments.map((segment: WhisperASRSegment) => segment.text).join("\n");
} else {
// Fallback to full text if no timestamps are required
// Fallback to full text if no segments are there
return preprocessed.text;
}
} catch (error) {
Expand Down

0 comments on commit 2f8a5d9

Please sign in to comment.