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

Function replace_all

src/framework/tokenizers/hf_tokenizer_json.cpp:11–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9namespace {
10
11std::string replace_all(std::string text, const std::string & needle, const std::string & replacement) {
12 if (needle.empty()) {
13 return text;
14 }
15 size_t pos = 0;
16 while ((pos = text.find(needle, pos)) != std::string::npos) {
17 text.replace(pos, needle.size(), replacement);
18 pos += replacement.size();
19 }
20 return text;
21}
22
23std::string decode_with_optional_skip(
24 const std::vector<std::string> & id_to_token,

Callers 1

Calls 3

emptyMethod · 0.45
findMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected