Skip to content

Commit

Permalink
Fix: made print sherpa_onnx_loge when it is in debug mode
Browse files Browse the repository at this point in the history
Currently, during normal use you may get a lot of print statements such as: `Use espeak-ng to handle the OOV: 'ipsum'` which may not be relevant unless you are debugging.
  • Loading branch information
ahadjawaid authored Feb 10, 2025
1 parent ad883d4 commit a563798
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions sherpa-onnx/csrc/kokoro-multi-lang-lexicon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ class KokoroMultiLangLexicon::Impl {
auto ids = ConvertWordToIds(word);
ans.insert(ans.end(), ids.begin(), ids.end());
} else {
SHERPA_ONNX_LOGE("Skip OOV: '%s'", word.c_str());
if (debug_) {
SHERPA_ONNX_LOGE("Skip OOV: '%s'", word.c_str());
}
}
}

Expand Down Expand Up @@ -312,8 +314,10 @@ class KokoroMultiLangLexicon::Impl {
this_sentence.insert(this_sentence.end(), ids.begin(), ids.end());
this_sentence.push_back(space_id);
} else {
SHERPA_ONNX_LOGE("Use espeak-ng to handle the OOV: '%s'", word.c_str());

if (debug_) {
SHERPA_ONNX_LOGE("Use espeak-ng to handle the OOV: '%s'", word.c_str());
}

piper::eSpeakPhonemeConfig config;

config.voice = voice;
Expand All @@ -333,8 +337,10 @@ class KokoroMultiLangLexicon::Impl {
if (token2id_.count(token)) {
ids.push_back(token2id_.at(token));
} else {
SHERPA_ONNX_LOGE("Skip OOV token '%s' from '%s'", token.c_str(),
word.c_str());
if (debug_) {
SHERPA_ONNX_LOGE("Skip OOV token '%s' from '%s'", token.c_str(),
word.c_str());
}
}
}
}
Expand Down

0 comments on commit a563798

Please sign in to comment.