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

Function approximate_phoneme_count

src/models/miotts/session.cpp:377–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375}
376
377int64_t approximate_phoneme_count(const std::string & text, const std::string & language) {
378 if (language == "en") {
379 int64_t count = 0;
380 for (const unsigned char ch : text) {
381 if (is_ascii_alpha(ch) || (ch >= '0' && ch <= '9')) {
382 ++count;
383 }
384 }
385 return std::max<int64_t>(count, 1);
386 }
387 return std::max<int64_t>(static_cast<int64_t>(engine::text::utf8_codepoint_count(text, "MioTTS best_of_n text")), 1);
388}
389
390double punctuation_bonus_seconds(const std::string & text) {
391 double bonus = 0.0;

Callers 1

length_penaltyFunction · 0.85

Calls 2

is_ascii_alphaFunction · 0.85
utf8_codepoint_countFunction · 0.85

Tested by

no test coverage detected