MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / shorten_text

Function shorten_text

tests/perf/model_perf.cpp:136–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136std::string shorten_text(std::string text, size_t limit) {
137 if (text.size() <= limit) {
138 return text;
139 }
140 size_t cut = text.rfind(' ', limit);
141 if (cut == std::string::npos || cut < (limit / 2)) {
142 cut = limit;
143 }
144 text.resize(cut);
145 while (!text.empty() && std::isspace(static_cast<unsigned char>(text.back())) != 0) {
146 text.pop_back();
147 }
148 return text;
149}
150
151std::filesystem::path write_clipped_wav(
152 const std::filesystem::path & source_path,

Callers 1

derive_warmup_requestFunction · 0.70

Calls 3

sizeMethod · 0.45
resizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected