| 183 | throw std::runtime_error("failed to open workflow batch text file: " + path.string()); |
| 184 | } |
| 185 | std::ostringstream raw; |
| 186 | raw << input.rdbuf(); |
| 187 | return raw.str(); |
| 188 | } |
| 189 | |
| 190 | std::string normalize_text_as_paragraph(const std::string & text) { |
| 191 | std::string normalized; |
| 192 | bool in_space = false; |
| 193 | for (unsigned char ch : text) { |
| 194 | if (std::isspace(ch) != 0) { |
| 195 | in_space = !normalized.empty(); |
| 196 | continue; |
| 197 | } |
| 198 | if (in_space) { |
| 199 | normalized.push_back(' '); |
| 200 | in_space = false; |
| 201 | } |
| 202 | normalized.push_back(static_cast<char>(ch)); |
| 203 | } |
no test coverage detected