From 26ab4125487e18295e8c3061427fdf015729b257 Mon Sep 17 00:00:00 2001 From: mushan0x0 Date: Fri, 29 Dec 2023 23:48:42 +0800 Subject: [PATCH] Revert "Update splitTextIntoSegments.ts" This reverts commit cbba2394353eef23a662de6dec6ef943887cbc34. --- src/core/utils/splitTextIntoSegments.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/utils/splitTextIntoSegments.ts b/src/core/utils/splitTextIntoSegments.ts index 1d71903..4c9e3d7 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.split(/(?<=[!.;?])/g); const segments: string[] = []; let currentSegment = '';