Skip to content

release: v0.25.0 — caption follows the transcript's script (CJK cues without spaces, character-bounded) - #119

Merged
renezander030 merged 1 commit into
masterfrom
release/v0.25.0
Sep 18, 2026
Merged

renezander030 merged 1 commit into
masterfrom
release/v0.25.0

Conversation

@renezander030

Copy link
Copy Markdown
Owner

What changes

  • caption follows the transcript's script. Whisper's "words" for Chinese and Japanese are single characters or short tokens, so the Latin defaults (four words per cue, joined with spaces) produced fragments with spaces between the characters. Cues in Chinese and Japanese are now joined without spaces and bounded by characters alone, at the width lint holds captions to (16 zh, 13 ja; Korean keeps spaces and four words at 16). Karaoke ranges follow the new offsets. The result reports caption_script (latin | zh | ja | ko). An explicit --max-words / --max-chars applies as given.
  • Library: groupWords takes a separator; wordSeparator, groupingDefaults, GroupingDefaults exported; the script detection moved to src/script.ts and stays exported from the lint entry points.
  • caption --max-chars documented next to --max-words; the Chinese README notes the feature in 科技爱好者周刊 issue 413; version 0.25.0, changelog, README highlights (v0.25.0 and v0.24.0 kept).

Verification

  • npm run lint clean; full suite green on the pre-commit hook; new test/caption-cjk.test.mjs (script detection, separators, grouping defaults, groupWords with and without a separator, and a fake-whisper karaoke run on an 18-character Chinese transcript: space-free cues of at most 16 characters, third word's highlight range [2, 3], --max-words 6 honoured).

Review notes

  • Base: 72cd7d3 (v0.24.0). Touched: src/caption.ts, src/script.ts (new), src/lint.ts (moved definitions, re-exports), src/lib.ts, src/command-specs.ts, READMEs, changelog. Untouched: --script alignment still tokenizes the script file on whitespace (a Chinese script line is one token to it), import-srt, rendering.
  • Behaviour change only for CJK transcripts; Latin output is byte-identical (existing caption tests unchanged).

Whisper's words for Chinese and Japanese are single characters or short
tokens, so the Latin defaults (four words per cue, joined with spaces)
produced fragments with spaces between the characters. Cues in Chinese
and Japanese are now joined without spaces and bounded by characters
alone, at the width lint holds captions to (16 zh, 13 ja; Korean keeps
spaces and four words at 16); karaoke ranges follow the new offsets; the
result reports caption_script. An explicit --max-words / --max-chars
applies as given. groupWords takes a separator; wordSeparator and
groupingDefaults are exported; the script detection lives in script.ts
and ships its declarations.

Also: caption --max-chars documented, the Chinese README notes the
feature in 科技爱好者周刊 issue 413, version 0.25.0, changelog, README
highlights.

Tests: test/caption-cjk.test.mjs.
@renezander030
renezander030 merged commit 7eb07f6 into master Sep 18, 2026
9 checks passed
@renezander030
renezander030 deleted the release/v0.25.0 branch September 18, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant