From b8825902d93d5017e44828316062dc8306b7ddcd Mon Sep 17 00:00:00 2001
From: Yabin Li <wucong.lyb@alibaba-inc.com>
Date: 星期二, 26 十二月 2023 10:51:00 +0800
Subject: [PATCH] support ngram and fst hotword for 2pass-offline (#1205)
---
runtime/onnxruntime/src/tpass-stream.cpp | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/runtime/onnxruntime/src/tpass-stream.cpp b/runtime/onnxruntime/src/tpass-stream.cpp
index a3e1b0e..b723e0f 100644
--- a/runtime/onnxruntime/src/tpass-stream.cpp
+++ b/runtime/onnxruntime/src/tpass-stream.cpp
@@ -66,6 +66,20 @@
LOG(ERROR) <<"Can not find offline-model-dir or online-model-dir";
exit(-1);
}
+
+ // Lm resource
+ if (model_path.find(LM_DIR) != model_path.end() && model_path.at(LM_DIR) != "") {
+ string fst_path, lm_config_path, lex_path;
+ fst_path = PathAppend(model_path.at(LM_DIR), LM_FST_RES);
+ lm_config_path = PathAppend(model_path.at(LM_DIR), LM_CONFIG_NAME);
+ lex_path = PathAppend(model_path.at(LM_DIR), LEX_PATH);
+ if (access(lex_path.c_str(), F_OK) != 0 )
+ {
+ LOG(ERROR) << "Lexicon.txt file is not exist, please use the latest version. Skip load LM model.";
+ }else{
+ asr_handle->InitLm(fst_path, lm_config_path, lex_path);
+ }
+ }
// PUNC model
if(model_path.find(PUNC_DIR) != model_path.end()){
--
Gitblit v1.9.1