release: v0.25.0 — caption follows the transcript's script (CJK cues without spaces, character-bounded) - #119
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
captionfollows 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 widthlintholds captions to (16 zh, 13 ja; Korean keeps spaces and four words at 16). Karaoke ranges follow the new offsets. The result reportscaption_script(latin|zh|ja|ko). An explicit--max-words/--max-charsapplies as given.groupWordstakes aseparator;wordSeparator,groupingDefaults,GroupingDefaultsexported; the script detection moved tosrc/script.tsand stays exported from the lint entry points.caption --max-charsdocumented 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 lintclean; full suite green on the pre-commit hook; newtest/caption-cjk.test.mjs(script detection, separators, grouping defaults,groupWordswith 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 6honoured).Review notes
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:--scriptalignment still tokenizes the script file on whitespace (a Chinese script line is one token to it),import-srt, rendering.