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.
This commit is contained in:
@@ -193,9 +193,11 @@ class KokoroMultiLangLexicon::Impl {
|
|||||||
auto ids = ConvertWordToIds(word);
|
auto ids = ConvertWordToIds(word);
|
||||||
ans.insert(ans.end(), ids.begin(), ids.end());
|
ans.insert(ans.end(), ids.begin(), ids.end());
|
||||||
} else {
|
} else {
|
||||||
|
if (debug_) {
|
||||||
SHERPA_ONNX_LOGE("Skip OOV: '%s'", word.c_str());
|
SHERPA_ONNX_LOGE("Skip OOV: '%s'", word.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
@@ -312,7 +314,9 @@ class KokoroMultiLangLexicon::Impl {
|
|||||||
this_sentence.insert(this_sentence.end(), ids.begin(), ids.end());
|
this_sentence.insert(this_sentence.end(), ids.begin(), ids.end());
|
||||||
this_sentence.push_back(space_id);
|
this_sentence.push_back(space_id);
|
||||||
} else {
|
} else {
|
||||||
|
if (debug_) {
|
||||||
SHERPA_ONNX_LOGE("Use espeak-ng to handle the OOV: '%s'", word.c_str());
|
SHERPA_ONNX_LOGE("Use espeak-ng to handle the OOV: '%s'", word.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
piper::eSpeakPhonemeConfig config;
|
piper::eSpeakPhonemeConfig config;
|
||||||
|
|
||||||
@@ -333,11 +337,13 @@ class KokoroMultiLangLexicon::Impl {
|
|||||||
if (token2id_.count(token)) {
|
if (token2id_.count(token)) {
|
||||||
ids.push_back(token2id_.at(token));
|
ids.push_back(token2id_.at(token));
|
||||||
} else {
|
} else {
|
||||||
|
if (debug_) {
|
||||||
SHERPA_ONNX_LOGE("Skip OOV token '%s' from '%s'", token.c_str(),
|
SHERPA_ONNX_LOGE("Skip OOV token '%s' from '%s'", token.c_str(),
|
||||||
word.c_str());
|
word.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this_sentence.size() + ids.size() + 3 > max_len - 2) {
|
if (this_sentence.size() + ids.size() + 3 > max_len - 2) {
|
||||||
this_sentence.push_back(0);
|
this_sentence.push_back(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user