From 221ec3954727ab1fa41d458db3784d1190d57bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D0=B5=D0=BE=D1=80=D0=B3=D0=B8=D0=B9=20=D0=90=D0=BF?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D0=BD?= <70803676+Egorgij21@users.noreply.github.com> Date: Tue, 21 May 2024 20:55:09 +0300 Subject: [PATCH] Update offline-recognizer-transducer-impl.h there were no initialization of hotwords for __ANDROID_API__ > 9 --- .../csrc/offline-recognizer-transducer-impl.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/sherpa-onnx/csrc/offline-recognizer-transducer-impl.h b/sherpa-onnx/csrc/offline-recognizer-transducer-impl.h index 5051c8b65..028602016 100644 --- a/sherpa-onnx/csrc/offline-recognizer-transducer-impl.h +++ b/sherpa-onnx/csrc/offline-recognizer-transducer-impl.h @@ -111,6 +111,10 @@ class OfflineRecognizerTransducerImpl : public OfflineRecognizerImpl { symbol_table_(mgr, config_.model_config.tokens), model_(std::make_unique(mgr, config_.model_config)) { + if (!config_.hotwords_file.empty()) { + InitHotwords(); + } + if (config_.decoding_method == "greedy_search") { decoder_ = std::make_unique( model_.get(), config_.blank_penalty); @@ -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(iss); - } - - if (!config_.hotwords_file.empty()) { - InitHotwords(mgr); - } - decoder_ = std::make_unique( model_.get(), lm_.get(), config_.max_active_paths, config_.lm_config.scale, config_.blank_penalty);