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

Function asr_error

src/models/miotts/session.cpp:544–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

542}
543
544double asr_error(const std::string & reference, const std::string & hypothesis, const std::string & language) {
545 if (language == "en") {
546 const auto ref = normalize_for_wer(reference);
547 const auto hyp = normalize_for_wer(hypothesis);
548 if (ref.empty()) {
549 return hyp.empty() ? 0.0 : 1.0;
550 }
551 return static_cast<double>(edit_distance(ref, hyp)) / static_cast<double>(ref.size());
552 }
553 const auto ref = normalize_for_cer(reference);
554 const auto hyp = normalize_for_cer(hypothesis);
555 if (ref.empty()) {
556 return hyp.empty() ? 0.0 : 1.0;
557 }
558 return static_cast<double>(edit_distance(ref, hyp)) / static_cast<double>(ref.size());
559}
560
561} // namespace
562

Callers 1

runMethod · 0.85

Calls 5

normalize_for_werFunction · 0.85
normalize_for_cerFunction · 0.85
edit_distanceFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected