Skip to content

toSrt(): max amount of words per SRT item instead of using the utterances array #308

Discussion options

You must be logged in to vote

Hi @carstenschaefer, what programming language / SDK are you working with? We have some support for this in Python and Node SDKs. For instance, the Python SDK has a line_length parameter in the to_SRT() and to_WebVTT() methods, which still uses utterances if available, but then splits the utterances by a maximum number of words in the line length. For instance:

from deepgram import Deepgram
deepgram = Deepgram("<API key>")
response = deepgram.transcription.sync_prerecorded({"url": "https://static.deepgram.com/examples/interview_speech-analytics.wav"}, {'punctuate': True, 'smart_format': True, 'model': 'nova', 'utterances': True})

Then setting a maximum number of 15 words returns results …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@carstenschaefer
Comment options

Answer selected by carstenschaefer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants