From 72af0f56975bfea20ff340777b3c940b006bf42a Mon Sep 17 00:00:00 2001 From: "HY. Kelvin Lee" <34256578+hykelvinlee42@users.noreply.github.com> Date: Thu, 2 Mar 2023 11:32:16 -0500 Subject: [PATCH] main : add csv header (#552) --- examples/main/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/main/main.cpp b/examples/main/main.cpp index b8366b7..e1853c6 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -352,13 +352,14 @@ bool output_csv(struct whisper_context * ctx, const char * fname) { fprintf(stderr, "%s: saving output to '%s'\n", __func__, fname); const int n_segments = whisper_full_n_segments(ctx); + fout << "start,end,text\n"; for (int i = 0; i < n_segments; ++i) { const char * text = whisper_full_get_segment_text(ctx, i); const int64_t t0 = whisper_full_get_segment_t0(ctx, i); const int64_t t1 = whisper_full_get_segment_t1(ctx, i); //need to multiply times returned from whisper_full_get_segment_t{0,1}() by 10 to get milliseconds. - fout << 10 * t0 << ", " << 10 * t1 << ", \"" << text << "\"\n"; + fout << 10 * t0 << "," << 10 * t1 << ",\"" << text << "\"\n"; } return true;