mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-31 12:15:27 -07:00
fix(subtitles): preserve lyric selection and deduplicate secondary text
- Seek sidebar selections past overlapping karaoke exit spans - Collapse duplicate long ASS lines and omit reconstructed sign grids
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
const MIN_FLATTENED_DUPLICATE_LENGTH = 16;
|
||||
const TERMINAL_SENTENCE_PUNCTUATION = /[.!?。!?…⋯]+$/gu;
|
||||
|
||||
/**
|
||||
* Identifies long lines that become duplicates when positioned ASS events are
|
||||
* flattened into the secondary subtitle bar. Short dialogue stays distinct.
|
||||
*/
|
||||
export function flattenedSecondarySubtitleLineIdentity(text: string): string | null {
|
||||
const identity = text
|
||||
.normalize('NFKC')
|
||||
.replace(/\s+/gu, '')
|
||||
.replace(TERMINAL_SENTENCE_PUNCTUATION, '');
|
||||
|
||||
return identity.length >= MIN_FLATTENED_DUPLICATE_LENGTH ? identity : null;
|
||||
}
|
||||
Reference in New Issue
Block a user