|
|
|
@ -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;
|
|
|
|
|