Show verbose logs in homophone replacer (#2194)
This commit is contained in:
@@ -90,7 +90,7 @@ jobs:
|
||||
run: |
|
||||
opts='--break-system-packages'
|
||||
v=${{ matrix.python-version }}
|
||||
if [[ $v == cp37 || $v == cp38 || $v == cp39 ]]; then
|
||||
if [[ $v == cp38 || $v == cp39 ]]; then
|
||||
opts=''
|
||||
fi
|
||||
|
||||
|
||||
@@ -143,6 +143,12 @@ class HomophoneReplacer::Impl {
|
||||
}
|
||||
|
||||
std::string Apply(const std::string &text) const {
|
||||
std::string ans;
|
||||
|
||||
if (text.empty()) {
|
||||
return ans;
|
||||
}
|
||||
|
||||
bool is_hmm = true;
|
||||
|
||||
std::vector<std::string> words;
|
||||
@@ -170,13 +176,16 @@ class HomophoneReplacer::Impl {
|
||||
pronunciations.push_back(std::move(p));
|
||||
}
|
||||
|
||||
std::string ans;
|
||||
for (const auto &r : replacer_list_) {
|
||||
ans = r->Normalize(words, pronunciations);
|
||||
// TODO(fangjun): We support only 1 rule fst at present.
|
||||
break;
|
||||
}
|
||||
|
||||
if (config_.debug) {
|
||||
SHERPA_ONNX_LOGE("Output text: '%s'", ans.c_str());
|
||||
}
|
||||
|
||||
return ans;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user