继续操作前请注册或者登录。
ahadjawaid
Committed by GitHub

Fix: made print sherpa_onnx_loge when it is in debug mode (#1838)

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.
@@ -193,7 +193,9 @@ class KokoroMultiLangLexicon::Impl { @@ -193,7 +193,9 @@ class KokoroMultiLangLexicon::Impl {
193 auto ids = ConvertWordToIds(word); 193 auto ids = ConvertWordToIds(word);
194 ans.insert(ans.end(), ids.begin(), ids.end()); 194 ans.insert(ans.end(), ids.begin(), ids.end());
195 } else { 195 } else {
196 - SHERPA_ONNX_LOGE("Skip OOV: '%s'", word.c_str()); 196 + if (debug_) {
  197 + SHERPA_ONNX_LOGE("Skip OOV: '%s'", word.c_str());
  198 + }
197 } 199 }
198 } 200 }
199 201
@@ -312,8 +314,10 @@ class KokoroMultiLangLexicon::Impl { @@ -312,8 +314,10 @@ class KokoroMultiLangLexicon::Impl {
312 this_sentence.insert(this_sentence.end(), ids.begin(), ids.end()); 314 this_sentence.insert(this_sentence.end(), ids.begin(), ids.end());
313 this_sentence.push_back(space_id); 315 this_sentence.push_back(space_id);
314 } else { 316 } else {
315 - SHERPA_ONNX_LOGE("Use espeak-ng to handle the OOV: '%s'", word.c_str());  
316 - 317 + if (debug_) {
  318 + SHERPA_ONNX_LOGE("Use espeak-ng to handle the OOV: '%s'", word.c_str());
  319 + }
  320 +
317 piper::eSpeakPhonemeConfig config; 321 piper::eSpeakPhonemeConfig config;
318 322
319 config.voice = voice; 323 config.voice = voice;
@@ -333,8 +337,10 @@ class KokoroMultiLangLexicon::Impl { @@ -333,8 +337,10 @@ class KokoroMultiLangLexicon::Impl {
333 if (token2id_.count(token)) { 337 if (token2id_.count(token)) {
334 ids.push_back(token2id_.at(token)); 338 ids.push_back(token2id_.at(token));
335 } else { 339 } else {
336 - SHERPA_ONNX_LOGE("Skip OOV token '%s' from '%s'", token.c_str(),  
337 - word.c_str()); 340 + if (debug_) {
  341 + SHERPA_ONNX_LOGE("Skip OOV token '%s' from '%s'", token.c_str(),
  342 + word.c_str());
  343 + }
338 } 344 }
339 } 345 }
340 } 346 }