diff --git a/src/core/utils/splitTextIntoSegments.ts b/src/core/utils/splitTextIntoSegments.ts index 4c9e3d7..bcf2668 100644 --- a/src/core/utils/splitTextIntoSegments.ts +++ b/src/core/utils/splitTextIntoSegments.ts @@ -25,7 +25,7 @@ const toHalfWidthAndCleanSpace = (str: string): string => { export const splitTextIntoSegments = (text: string, maxChars: number = 100): string[] => { text = toHalfWidthAndCleanSpace(text); - const sentences = text.split(/(?<=[!.;?])/g); + const sentences = text.match(/[^.!;?]+[.!;?]+/g) || []; const segments: string[] = []; let currentSegment = '';