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

Function normalize_text_as_paragraph

app/cli/batch.cpp:45–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45std::string normalize_text_as_paragraph(const std::string & text) {
46 std::string normalized;
47 bool in_space = false;
48 for (unsigned char ch : text) {
49 if (std::isspace(ch)) {
50 in_space = !normalized.empty();
51 continue;
52 }
53 if (in_space) {
54 normalized.push_back(' ');
55 in_space = false;
56 }
57 normalized.push_back(static_cast<char>(ch));
58 }
59 return normalized;
60}
61
62std::string read_plain_text_batch_file(const std::filesystem::path & path) {
63 return normalize_text_as_paragraph(read_text_file(path));

Callers 2

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected