@pls-compile-owo/fisheye 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  "hasOfficialSubs": false,
6
6
  "expectedQuality": null,
7
7
  "subtitleLines": [],
8
- "expectedAdSegments": 3,
8
+ "expectedAdSegments": 0,
9
9
  "danmaku": [
10
10
  {
11
11
  "t": 79.295,
@@ -516,5 +516,6 @@
516
516
  "text": "好想把灯打开"
517
517
  }
518
518
  ],
519
- "danmakuCount": 127
519
+ "danmakuCount": 127,
520
+ "groundTruthNote": "2026-11-14 人工确认:04:50-05:50 / 08:50-10:40 / 11:40-13:00 三段均非广告(艺术短片,无赞助),修复稀疏弹幕误报后应检测为 0 段"
520
521
  }
@@ -52,3 +52,32 @@ for (const { file, data } of fixtures) {
52
52
  for (let i = 1; i < r.times.length; i++) assert.ok(r.times[i] > r.times[i - 1])
53
53
  })
54
54
  }
55
+
56
+ // ── 广告段真值评估(人工标注的广告段 vs 检测结果)────────────────────────
57
+ const adTruthDir = path.join(path.dirname(fileURLToPath(import.meta.url)), 'golden', 'ad-truth')
58
+ const adTruthFiles = fs.existsSync(adTruthDir) ? fs.readdirSync(adTruthDir).filter((f) => f.endsWith('.json')) : []
59
+
60
+ test('广告真值样本存在', () => {
61
+ assert.ok(adTruthFiles.length >= 1, '至少 1 条人工标注的广告真值')
62
+ })
63
+
64
+ for (const file of adTruthFiles) {
65
+ const data = JSON.parse(fs.readFileSync(path.join(adTruthDir, file), 'utf8'))
66
+ test(`${data.bvid}(${String(data.title).slice(0, 20)}):广告段检测覆盖真值`, () => {
67
+ const segs = detectAdSegments(data.danmaku, data.duration)
68
+ let bestCover = 0
69
+ for (const truth of data.truthAdSegments) {
70
+ for (const s of segs) {
71
+ const overlap = Math.max(0, Math.min(s.to, truth.to) - Math.max(s.from, truth.from))
72
+ bestCover = Math.max(bestCover, overlap / Math.max(1, truth.to - truth.from))
73
+ }
74
+ }
75
+ assert.ok(bestCover >= 0.8, `至少覆盖真值广告段的 80%(实际 ${(bestCover * 100).toFixed(0)}%)`)
76
+ // 无片头/片尾低置信度段(片头片尾弹幕少是正常现象)
77
+ for (const s of segs) {
78
+ if (s.confidence === 'low') {
79
+ assert.ok(s.from >= 60 && s.to <= data.duration - 60, `低置信度段不应出现在片头/片尾:${s.ts}`)
80
+ }
81
+ }
82
+ })
83
+ }