mirror of
https://github.com/chidiwilliams/buzz.git
synced 2026-03-14 14:45:46 +01:00
Created option for text viewer by adding BUZZ_PARAGRAPH_SPLIT_TIME environment variable (#1246)
Co-authored-by: Raivis Dejus <orvils@gmail.com>
This commit is contained in:
parent
862701a9ef
commit
44e962d1e2
3 changed files with 8 additions and 2 deletions
|
|
@ -166,8 +166,10 @@ def write_output(
|
|||
combined_text = ""
|
||||
previous_end_time = None
|
||||
|
||||
paragraph_split_time = int(os.getenv("BUZZ_PARAGRAPH_SPLIT_TIME", "2000"))
|
||||
|
||||
for segment in segments:
|
||||
if previous_end_time is not None and (segment.start - previous_end_time) >= 2000:
|
||||
if previous_end_time is not None and (segment.start - previous_end_time) >= paragraph_split_time:
|
||||
combined_text += "\n\n"
|
||||
combined_text += getattr(segment, segment_key).strip() + " "
|
||||
previous_end_time = segment.end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
import logging
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
|
|
@ -825,8 +826,10 @@ class TranscriptionViewerWidget(QWidget):
|
|||
combined_text = ""
|
||||
previous_end_time = None
|
||||
|
||||
paragraph_split_time = int(os.getenv("BUZZ_PARAGRAPH_SPLIT_TIME", "2000"))
|
||||
|
||||
for segment in segments:
|
||||
if previous_end_time is not None and (segment.start_time - previous_end_time) >= 2000:
|
||||
if previous_end_time is not None and (segment.start_time - previous_end_time) >= paragraph_split_time:
|
||||
combined_text += "\n\n"
|
||||
combined_text += segment.text.strip() + " "
|
||||
previous_end_time = segment.end_time
|
||||
|
|
|
|||
|
|
@ -119,3 +119,4 @@ Example of data collected by telemetry:
|
|||
```
|
||||
Buzz: 1.3.0, locale: ('lv_LV', 'UTF-8'), system: Linux, release: 6.14.0-27-generic, machine: x86_64, version: #27~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 17:38:49 UTC 2,
|
||||
```
|
||||
**BUZZ_PARAGRAPH_SPLIT_TIME** - Time in milliseconds of silence to split paragraphs in transcript and add two newlines when exporting the transcripts as text. Default is `2000` or 2 seconds. Available since `1.3.0`
|
||||
Loading…
Add table
Add a link
Reference in a new issue