Prompt48 commited on
Commit
70266e4
·
verified ·
1 Parent(s): bb76559

Upload edit/analyze.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. edit/analyze.py +47 -0
edit/analyze.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json, sys
2
+
3
+ d = json.load(open(sys.argv[1], encoding="utf-8"))
4
+ words = [w for w in d["words"] if w.get("type") == "word"]
5
+
6
+ def fmt(t):
7
+ m = int(t // 60); s = t - m*60
8
+ return f"{m}:{s:05.2f}"
9
+
10
+ # 1) silence gaps between consecutive words
11
+ print("=== SILENCE GAPS >= 0.35s ===")
12
+ GAP = 0.35
13
+ gaps = []
14
+ for i in range(1, len(words)):
15
+ g = words[i]["start"] - words[i-1]["end"]
16
+ if g >= GAP:
17
+ gaps.append((words[i-1]["end"], words[i]["start"], g, words[i-1]["text"], words[i]["text"]))
18
+ for end, start, g, prev, nxt in gaps:
19
+ print(f" {fmt(end)} -> {fmt(start)} gap={g:4.2f}s ...{prev!r} | {nxt!r}...")
20
+ print(f" total gaps >= {GAP}s: {len(gaps)}")
21
+
22
+ # 2) anchor keywords -> first occurrence timestamp(s)
23
+ print("\n=== KEYWORD ANCHORS (all occurrences) ===")
24
+ anchors = [
25
+ "MTP", "multi-token", "autoregression", "draft", "verify", "verified",
26
+ "acceptance", "VRAM", "install", "Studio", "Windows", "beta", "stable",
27
+ "update", "04.13", "04.14", "download", "model search", "unsloth",
28
+ "speculative", "eject", "tokens per second", "capital", "essay",
29
+ "RunPod", "Hostinger", "subscribe", "without MTP", "with MTP",
30
+ ]
31
+ # rebuild a stream of (word, start, end) plus simple lowercased text join for phrase search
32
+ seq = [(w["text"].strip(), w["start"], w["end"]) for w in words]
33
+ lc = [t.lower() for t,_,_ in seq]
34
+ for kw in anchors:
35
+ parts = kw.lower().split()
36
+ hits = []
37
+ for i in range(len(lc)-len(parts)+1):
38
+ if lc[i:i+len(parts)] == parts:
39
+ hits.append(seq[i][1])
40
+ if hits:
41
+ print(f" {kw:18s}: " + ", ".join(fmt(h) for h in hits[:8]) + ("" if len(hits)<=8 else f" (+{len(hits)-8} more)"))
42
+
43
+ # 3) filler / disfluency quick scan
44
+ print("\n=== FILLER WORDS (uh/um) ===")
45
+ for w in words:
46
+ if w["text"].strip().lower().rstrip(",.") in ("uh","um"):
47
+ print(f" {fmt(w['start'])} {w['text']!r}")