caption.js 2.3.0: dual-speaker captions, leading sentences, and the speaker of each line - #292
Merged
Merged
Conversation
…peaker of each line With joinSentences on, a short sentence could still end up alone in a caption: when it opened another speaker's turn, since a label always started a new caption, and when the sentence after it was too long to share one, since joining only worked backwards. - dualSpeakers: two short sentences from different speakers share a caption in the Netflix form - two speakers at most, one per line, each line opening with a hyphen. A caption with one speaker never has a hyphen. Each side is one speaker's whole sentences, the hyphen counts towards the line length, and paragraphBreaks wins. - leadSentences: a short sentence that could not join the caption before it is laid out as one run with the long sentence after it, when both are one speaker's and within maxJoinGap. - Every cue in result.data carries speakers, the speaker of each of its lines, carried through the whole turn. With neither option given, the captions are what 2.2.0 generated; the speakers field is the only difference. Closes #291
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.
Closes #291.
Follows #289. With
joinSentenceson, a short sentence could still end up alone in a caption in two cases. The opening of an interview shows both:This generated
to start?·Sure.·So to start off, Dr. Ashby,…dualSpeakers-to start?/-Sure.). The hyphen marks two speakers sharing a caption, not a change of speaker, so a caption with one speaker never has one. Each side is one speaker's whole sentences. The tail of a long sentence cannot be a side. The hyphen counts towards the line length, a third turn starts a new caption, andparagraphBreakswins.leadSentencesminLength) that could not join the caption before it is laid out as one run with the long sentence after it, when both are one speaker's and withinmaxJoinGap. This is never done across a speaker label or a paragraph that must break. Joining backwards comes first. No sentence is split that would not have been, because the long sentence is divided across captions either way.speakersresult.datanow carries the speaker of each of its lines (["speaker-A", "speaker-B"], or""where the transcript names none). The speaker is carried through the whole turn, since previously only the sentence a label opened knew its speaker.[Ann]andAnn:both read asAnn. This is groundwork for #284.Compatibility. With neither option given,
vtt,srtand every cue's text are what 2.2.0 generated. The only difference is the additivespeakersfield. A label still ends ordinary joining, as before, including one that repeats the speaker already talking. A test pins this.With
leadSentences, the line break still falls where the splitter puts it. The opening above becomesSure. So to start off,/Dr. Ashby, can you just, because a comma pastminLengthis a preferred break.caption.d.tsand the README document the options and the field. There are 9 new tests. The caption suite is 37/37 and the whole suite is 98/98. The version header moves to 2.3.0.changelog.mdand the package version are left for the release commit.Companion: hyperaudio/hyperaudio-lite-editor#666.