diff --git a/funasr/runtime/onnxruntime/src/paraformer.cpp b/funasr/runtime/onnxruntime/src/paraformer.cpp index 6d78fef16..9b92e9018 100644 --- a/funasr/runtime/onnxruntime/src/paraformer.cpp +++ b/funasr/runtime/onnxruntime/src/paraformer.cpp @@ -719,6 +719,7 @@ std::vector> Paraformer::CompileHotwordEmbedding(std::string std::vector hotword_matrix; std::vector lengths; int hotword_size = 1; + int real_hw_size = 0; if (!hotwords.empty()) { std::vector hotword_array = split(hotwords, ' '); hotword_size = hotword_array.size() + 1; @@ -735,6 +736,9 @@ std::vector> Paraformer::CompileHotwordEmbedding(std::string chars.insert(chars.end(), tokens.begin(), tokens.end()); } } + if(chars.size()==0){ + continue; + } std::vector hw_vector(max_hotword_len, 0); int vector_len = std::min(max_hotword_len, (int)chars.size()); for (int i=0; i> Paraformer::CompileHotwordEmbedding(std::string } std::cout << std::endl; lengths.push_back(vector_len); + real_hw_size += 1; hotword_matrix.insert(hotword_matrix.end(), hw_vector.begin(), hw_vector.end()); } + hotword_size = real_hw_size + 1; } std::vector blank_vec(max_hotword_len, 0); blank_vec[0] = 1; diff --git a/funasr/runtime/onnxruntime/src/seg_dict.cpp b/funasr/runtime/onnxruntime/src/seg_dict.cpp index 9dab2424d..4e7dab437 100644 --- a/funasr/runtime/onnxruntime/src/seg_dict.cpp +++ b/funasr/runtime/onnxruntime/src/seg_dict.cpp @@ -40,6 +40,7 @@ std::vector SegDict::GetTokensByWord(const std::string &word) { if (seg_dict.count(word)) return seg_dict[word]; else { + LOG(INFO)<< word <<" is OOV!"; std::vector vec; return vec; }