Crates.io | deepgram-rust-captions |
lib.rs | deepgram-rust-captions |
version | 0.1.2 |
source | src |
created_at | 2024-07-13 20:09:40.403728 |
updated_at | 2024-07-13 20:09:40.403728 |
description | Rust implementation of Deepgram's WebVTT and SRT formatting |
homepage | https://github.com/oele-isis-vanderbilt/deepgram-rust-captions |
repository | https://github.com/oele-isis-vanderbilt/deepgram-rust-captions |
max_upload_size | |
id | 1302597 |
size | 3,556,922 |
This package is the Rust implementation of Deepgram's WebVTT and SRT formatting. Given a transcription, this package can return a valid string to store as WebVTT or SRT caption files.
This implmentation is based (a direct port) on Deepgram's Python implementation of the same functionality. The original Python implementation can be found here.
Use cargo to install the package:
cargo add deepgram-rust-captions
use deepgram_rust_captions::{converters::DeepgramConverter, srt::srt, webvtt::webvtt};
use deepgram::transcription::prerecorded::Response as DGResponse;
fn main() {
let response: DGResponse = ...
let converter = DeepgramConverter::new(&response);
let srt_caption = srt(&converter, Some(10));
let webvtt_caption = webvtt(&converter, Some(10));
println!("{}", srt_caption);
println!("{}", webvtt_caption);
}