| 509 | } |
| 510 | |
| 511 | std::vector<uint32_t> normalize_for_cer(const std::string & text) { |
| 512 | std::vector<uint32_t> out; |
| 513 | for (const uint32_t cp : utf8_codepoints(lowercase_ascii(text), "MioTTS best_of_n ASR text")) { |
| 514 | if ((cp <= 0x7FU && std::isalnum(static_cast<unsigned char>(cp)) != 0) || is_japanese_codepoint(cp)) { |
| 515 | out.push_back(cp); |
| 516 | } |
| 517 | } |
| 518 | return out; |
| 519 | } |
| 520 | |
| 521 | template <typename T> |
| 522 | int64_t edit_distance(const std::vector<T> & ref, const std::vector<T> & hyp) { |
no test coverage detected