mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-31 00:15:28 -07:00
- Seek sidebar selections past overlapping karaoke exit spans - Collapse duplicate long ASS lines and omit reconstructed sign grids
16 lines
563 B
TypeScript
16 lines
563 B
TypeScript
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;
|
|
}
|