diff --git a/app/Services/Video/VideoAssemblyService.php b/app/Services/Video/VideoAssemblyService.php index f62b6c02..6f29d301 100644 --- a/app/Services/Video/VideoAssemblyService.php +++ b/app/Services/Video/VideoAssemblyService.php @@ -306,9 +306,9 @@ private function splitIntoSentences(string $text): array return [$text]; } - // 구두점 뒤 + 다음이 구두점이 아닐 때 + 공백 있을 때만 분리 - // "정말요?!" → 분리 안 됨, "정말요?! 다음 문장" → 분리됨 - $rawParts = preg_split('/(?<=[.!?。!?])(?![.!?。!?])\s+/u', $text, -1, PREG_SPLIT_NO_EMPTY); + // \K로 구두점은 앞 문장에 유지, 공백만 구분자로 소비 + // "정말요?!" → 분리 안 됨, "정말요?! 다음 문장" → ["정말요?!", "다음 문장"] + $rawParts = preg_split('/[.!?。!?](?![.!?。!?])\K\s+/u', $text, -1, PREG_SPLIT_NO_EMPTY); if (count($rawParts) <= 1) { return [$text];