refactor(video-pipeline): 移除 segments 机制,改为整段音频合成
移除 TTS 阶段逐句切分及 segments 数组逻辑,统一为整段音频合成。 CapCut 字幕切分由组装阶段按字符比例分配,简化音频上传、 时间线构建和字幕生成流程,减少冗余处理分支。
This commit is contained in:
@@ -165,8 +165,8 @@ function getManifestDir(manifestPath) {
|
||||
// ============================================================================
|
||||
|
||||
function splitTextIntoSentences(text) {
|
||||
const sentenceEnders = /[。!?;]/
|
||||
const clauseEnders = /[,:]/
|
||||
// 在句号、感叹号、分号、逗号处断句——它们是口播语音的天然呼吸点。
|
||||
const sentenceEnders = /[。!;,]/
|
||||
|
||||
const sentences = []
|
||||
let current = ''
|
||||
@@ -175,16 +175,13 @@ function splitTextIntoSentences(text) {
|
||||
current += char
|
||||
|
||||
if (sentenceEnders.test(char)) {
|
||||
sentences.push(current.trim().replace(/[。!?;,:、]/g, ''))
|
||||
current = ''
|
||||
} else if (clauseEnders.test(char) && current.length > 8) {
|
||||
sentences.push(current.trim().replace(/[。!?;,:、]/g, ''))
|
||||
sentences.push(current.trim().replace(/[。!;,:?、——…]/g, ''))
|
||||
current = ''
|
||||
}
|
||||
}
|
||||
|
||||
if (current.trim()) {
|
||||
sentences.push(current.trim().replace(/[。!?;,:、]/g, ''))
|
||||
sentences.push(current.trim().replace(/[。!;,:?、——…]/g, ''))
|
||||
}
|
||||
|
||||
return sentences
|
||||
|
||||
Reference in New Issue
Block a user