fix: 短时重复伪影也整条删除(判据补重复次数上限)
真实产物里出现 3.7 秒的 cue 被同一个假名填满 111 次(`は`×111),此前判据要求 "时长 ≥15 秒"才删,于是它漏到翻译层,最终变成 56 个"哈"进中文成品字幕。 - 判据改为:重复段占正文 ≥70% 且重复 ≥6 次,并且**时长 ≥15 秒或重复 ≥20 次**。 - 短条走"极端重复"档:真实呻吟的重复次数实测 ≤15(ぇ×15 占 3.2 秒),不会误删。 - 测试数据取自真实产物(A 的日语转写里那条 112 字短伪影)。
This commit is contained in:
@@ -330,3 +330,20 @@ def test_remove_repetition_entries_can_be_disabled() -> None:
|
||||
srt = _srt((artifact["start"], artifact["end"], artifact["text"]))
|
||||
|
||||
assert remove_repetition_entries(srt, threshold_seconds=0) == srt
|
||||
|
||||
|
||||
def test_remove_repetition_entries_deletes_short_but_extreme_repetition() -> None:
|
||||
"""数据:真实产物里的短时伪影——3.7 秒的 cue 被同一个假名填了 111 次。
|
||||
|
||||
过程:调用 remove_repetition_entries。
|
||||
|
||||
验证:整条删除。判据不能只看时长:这种短条会一路翻成 56 个"哈"进成品字幕,
|
||||
但真实呻吟的重复次数实测 ≤15,用重复次数上限即可区分。
|
||||
"""
|
||||
artifact = _REPETITION_CUES["short_artifacts"][0]
|
||||
srt = _srt((artifact["start"], artifact["end"], artifact["text"]))
|
||||
|
||||
cleaned = remove_repetition_entries(srt)
|
||||
|
||||
assert artifact["text"] not in cleaned
|
||||
assert parse_srt_entries(cleaned) == []
|
||||
|
||||
Reference in New Issue
Block a user