Repository navigation
fix(subtitle_gen): accept Doubao timestamps and join Chinese tokens - #828
henry56714 wants to merge 3 commits into
Conversation
calesthio
left a comment
There was a problem hiding this comment.
Reviewed against docs/PR_REVIEW_GUIDE.md at 910fa851293f9cc1efb849e1dce598f0600c0433 in an isolated worktree.
[P2] Preserve word boundaries around curly quotes in non-Chinese captions.
The Doubao timestamp defect is real and the 17 new tests pass, but the new _join_tokens treats curly quotes as Chinese boundaries for every language. Running execute with timed English tokens ["He", "said", "“hello", "world”", "today."] now writes "He said“hello world”today."; clean main writes "He said “hello world” today.". This affects ordinary SRT output as well as the shared correction/karaoke joining path.
This was reproduced entirely locally with canonical numeric timestamps, so it is independent of Doubao credentials, transport, SDK versions or fonts. Korean spacing still passes a separate control. Please make spacing suppression depend on the surrounding script/language rather than curly punctuation alone, and add English curly-quote and mixed-language regression cases while retaining the Chinese behavior. The existing timestamp suite also passes (4 tests).
Validation command: py -m pytest tests/tools/test_subtitle_doubao.py -q --tb=short -p no:cacheprovider. Clean-main comparison used c8066452 with the PR regression tests copied in; production code and dependencies were otherwise unchanged. Initial baseline: 16 failed, 1 passed in 0.42s.
…lack-frame check Ports the approach (not the diff) of upstream PRs still unmerged or closed: - piper_tts: feed narration to Piper as UTF-8 (OpenMontageInc#842); the Windows ANSI code page garbled CJK and accented text. - video_compose: decode ffprobe/ffmpeg text output as UTF-8 with errors=replace (part of OpenMontageInc#696) so a cp950/GBK console cannot kill the pipe reader. - subtitle_gen: no space between adjacent CJK tokens, karaoke markup aware (OpenMontageInc#828, defect 1 of OpenMontageInc#725). - video_compose final_review: judge black frames by mean luminance; the old "PNG < 2000 bytes" test never fired (a black 1280x720 PNG is 4349 bytes). Closed-unmerged OpenMontageInc#679, defect still present on upstream main. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks for catching the spacing regression. I fixed it in I also merged upstream |
Summary
Doubao TTS returns sentence and word timings as
startTime/endTimein seconds. Passing itssentencesoutput directly tosubtitle_genfails because the subtitle generator expectsstart/end. Chinese character tokens also acquire unwanted spaces when joined into captions.Related issue
No linked issue; reproduced with Doubao-shaped timestamp input.
Changes
start/endorstartTime/endTimepairs without mutating caller input. Preserve seconds and prefer canonical timestamps when both pairs exist.Testing
python -m pytest tests/tools/test_subtitle_doubao.py tests/tools/test_subtitle_timestamps.py -q— 21 passed.Coverage includes SRT/VTT/JSON, sentence-only timing, input preservation, invalid timing, canonical English output, mixed Chinese/English text, karaoke highlighting, and cue length boundaries.
Tests are offline. This PR does not change the Doubao API transport; no new live TTS request was made for this submission.
Checklist