Skip to content

Commit

Permalink
Update offline-recognizer-transducer-impl.h
Browse files Browse the repository at this point in the history
there were no initialization of hotwords for __ANDROID_API__ > 9
  • Loading branch information
Egorgij21 authored May 21, 2024
1 parent 4593ab4 commit 221ec39
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions sherpa-onnx/csrc/offline-recognizer-transducer-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ class OfflineRecognizerTransducerImpl : public OfflineRecognizerImpl {
symbol_table_(mgr, config_.model_config.tokens),
model_(std::make_unique<OfflineTransducerModel>(mgr,
config_.model_config)) {
if (!config_.hotwords_file.empty()) {
InitHotwords();
}

if (config_.decoding_method == "greedy_search") {
decoder_ = std::make_unique<OfflineTransducerGreedySearchDecoder>(
model_.get(), config_.blank_penalty);
Expand All @@ -119,16 +123,6 @@ class OfflineRecognizerTransducerImpl : public OfflineRecognizerImpl {
lm_ = OfflineLM::Create(mgr, config.lm_config);
}

if (!config_.model_config.bpe_vocab.empty()) {
auto buf = ReadFile(mgr, config_.model_config.bpe_vocab);
std::istringstream iss(std::string(buf.begin(), buf.end()));
bpe_encoder_ = std::make_unique<ssentencepiece::Ssentencepiece>(iss);
}

if (!config_.hotwords_file.empty()) {
InitHotwords(mgr);
}

decoder_ = std::make_unique<OfflineTransducerModifiedBeamSearchDecoder>(
model_.get(), lm_.get(), config_.max_active_paths,
config_.lm_config.scale, config_.blank_penalty);
Expand Down

0 comments on commit 221ec39

Please sign in to comment.