Extracts word-level timestamps from a segment if word_timestamps is enabled.
(self, segment, time_offset)
| 356 | return None |
| 357 | |
| 358 | def _extract_words(self, segment, time_offset): |
| 359 | """Extracts word-level timestamps from a segment if word_timestamps is enabled.""" |
| 360 | if not self.word_timestamps: |
| 361 | return None |
| 362 | words = getattr(segment, "words", None) |
| 363 | if not words: |
| 364 | return None |
| 365 | return [ |
| 366 | { |
| 367 | "word": w.word, |
| 368 | "start": "{:.3f}".format(time_offset + w.start), |
| 369 | "end": "{:.3f}".format(time_offset + w.end), |
| 370 | "probability": round(w.probability, 4), |
| 371 | } |
| 372 | for w in words |
| 373 | ] |
| 374 | |
| 375 | def update_segments(self, segments, duration): |
| 376 | """ |
no outgoing calls