Update srt_utils.py
Browse files- srt_utils.py +2 -2
srt_utils.py
CHANGED
|
@@ -299,7 +299,7 @@ def groq_combined_to_srt(data: dict, include_word_timings: bool = True) -> str:
|
|
| 299 |
dur_w0 = w0['end'] - w0['start']
|
| 300 |
dur_rest0 = rest0[-1]['end'] - rest0[0]['start']
|
| 301 |
avg_rest0 = dur_rest0 / len(rest0)
|
| 302 |
-
if dur_w0 >
|
| 303 |
w0['start'] = w0['end'] - avg_rest0
|
| 304 |
|
| 305 |
# 2. Last Word Fix (User Request)
|
|
@@ -307,7 +307,7 @@ def groq_combined_to_srt(data: dict, include_word_timings: bool = True) -> str:
|
|
| 307 |
dur_last = w_last['end'] - w_last['start']
|
| 308 |
dur_rest_last = rest_last[-1]['end'] - rest_last[0]['start']
|
| 309 |
avg_rest_last = dur_rest_last / len(rest_last)
|
| 310 |
-
if dur_last >
|
| 311 |
w_last['end'] = w_last['start'] + avg_rest_last
|
| 312 |
sub_groups = []
|
| 313 |
current_group = []
|
|
|
|
| 299 |
dur_w0 = w0['end'] - w0['start']
|
| 300 |
dur_rest0 = rest0[-1]['end'] - rest0[0]['start']
|
| 301 |
avg_rest0 = dur_rest0 / len(rest0)
|
| 302 |
+
if dur_w0 > 1.0:
|
| 303 |
w0['start'] = w0['end'] - avg_rest0
|
| 304 |
|
| 305 |
# 2. Last Word Fix (User Request)
|
|
|
|
| 307 |
dur_last = w_last['end'] - w_last['start']
|
| 308 |
dur_rest_last = rest_last[-1]['end'] - rest_last[0]['start']
|
| 309 |
avg_rest_last = dur_rest_last / len(rest_last)
|
| 310 |
+
if dur_last > 1.0:
|
| 311 |
w_last['end'] = w_last['start'] + avg_rest_last
|
| 312 |
sub_groups = []
|
| 313 |
current_group = []
|