Update whisper.cpp

pull/455/head
Matija Pevec 2 years ago committed by GitHub
parent beb9512be3
commit 8ea08d534b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2863,11 +2863,13 @@ static int whisper_wrap_segment(struct whisper_context & ctx, int max_len) {
}
const auto txt = whisper_token_to_str(&ctx, token.id);
std::string s = txt;
const int cur = strlen(txt);
if (acc + cur > max_len && i > 0) {
if (acc + cur > max_len && i > 0 && s.substr(0, 1) == " ") {
// split here
::trim(text);
ctx.result_all.back().text = std::move(text);
ctx.result_all.back().t1 = token.t0;
ctx.result_all.back().tokens.resize(i);
@ -2895,6 +2897,7 @@ static int whisper_wrap_segment(struct whisper_context & ctx, int max_len) {
}
}
::trim(text);
ctx.result_all.back().text = std::move(text);
return res;

Loading…
Cancel
Save