@@ -3401,26 +3401,6 @@ static void whisper_exp_compute_token_level_timestamps(
34013401 float thold_pt,
34023402 float thold_ptsum);
34033403
3404- // trim from start (in place)
3405- static inline void ltrim (std::string &s) {
3406- s.erase (s.begin (), std::find_if_not (s.begin (), s.end (), [](unsigned char ch) {
3407- return std::isspace (ch);
3408- }));
3409- }
3410-
3411- // trim from end (in place)
3412- static inline void rtrim (std::string &s) {
3413- s.erase (std::find_if_not (s.rbegin (), s.rend (), [](unsigned char ch) {
3414- return std::isspace (ch);
3415- }).base (), s.end ());
3416- }
3417-
3418- // trim from both ends (in place)
3419- static inline void trim (std::string &s) {
3420- rtrim (s);
3421- ltrim (s);
3422- }
3423-
34243404static inline bool should_split_on_word (const char * txt, bool split_on_word) {
34253405 if (!split_on_word) return true ;
34263406
@@ -3447,11 +3427,6 @@ static int whisper_wrap_segment(struct whisper_context & ctx, struct whisper_sta
34473427 const int cur = strlen (txt);
34483428
34493429 if (acc + cur > max_len && i > 0 && should_split_on_word (txt, split_on_word)) {
3450- // split here
3451- if (split_on_word) {
3452- trim (text);
3453- }
3454-
34553430 state.result_all .back ().text = std::move (text);
34563431 state.result_all .back ().t1 = token.t0 ;
34573432 state.result_all .back ().tokens .resize (i);
@@ -3479,9 +3454,6 @@ static int whisper_wrap_segment(struct whisper_context & ctx, struct whisper_sta
34793454 }
34803455 }
34813456
3482- if (split_on_word) {
3483- trim (text);
3484- }
34853457 state.result_all .back ().text = std::move (text);
34863458
34873459 return res;
0 commit comments