Spaces:
Runtime error
Runtime error
Add some more conditions
Browse files
functions/convert_time.py
CHANGED
@@ -40,11 +40,13 @@ def match_mask_and_transcript(split_punct, transcript, classification):
|
|
40 |
current_time = 0
|
41 |
for elem in timestamps:
|
42 |
# Threshold of 5 to see if it is a jump to another segment (also to make sure smaller segments are added together
|
43 |
-
if elem[0] > (current_time +
|
44 |
current += 1
|
45 |
times.append((elem[0], elem[0] + elem[1]))
|
46 |
current_time = elem[0] + elem[1]
|
47 |
else:
|
48 |
times[current] = (times[current][0], elem[0] + elem[1])
|
49 |
current_time = elem[0] + elem[1]
|
50 |
-
|
|
|
|
|
|
40 |
current_time = 0
|
41 |
for elem in timestamps:
|
42 |
# Threshold of 5 to see if it is a jump to another segment (also to make sure smaller segments are added together
|
43 |
+
if elem[0] > (current_time + 15):
|
44 |
current += 1
|
45 |
times.append((elem[0], elem[0] + elem[1]))
|
46 |
current_time = elem[0] + elem[1]
|
47 |
else:
|
48 |
times[current] = (times[current][0], elem[0] + elem[1])
|
49 |
current_time = elem[0] + elem[1]
|
50 |
+
|
51 |
+
return_times = [x for x in times if (x[1] - x[0]) > 10]
|
52 |
+
return return_times, timestamps
|