Spaces:
Running
Running
Joshua Lochner
commited on
Commit
·
2439d9a
1
Parent(s):
884d564
Ensure event duration is non-negative
Browse files- src/preprocess.py +3 -0
src/preprocess.py
CHANGED
|
@@ -94,6 +94,9 @@ def parse_transcript_json(json_data, granularity):
|
|
| 94 |
else:
|
| 95 |
total_event_duration_ms = event.get('dDurationMs', 0)
|
| 96 |
|
|
|
|
|
|
|
|
|
|
| 97 |
avg_seconds_per_character = (
|
| 98 |
total_event_duration_ms/total_characters)/1000
|
| 99 |
|
|
|
|
| 94 |
else:
|
| 95 |
total_event_duration_ms = event.get('dDurationMs', 0)
|
| 96 |
|
| 97 |
+
# Ensure duration is non-negative
|
| 98 |
+
total_event_duration_ms = max(total_event_duration_ms, 0)
|
| 99 |
+
|
| 100 |
avg_seconds_per_character = (
|
| 101 |
total_event_duration_ms/total_characters)/1000
|
| 102 |
|