Add streaming ASR support for HarmonyOS. (#1565)
This commit is contained in:
@@ -14,11 +14,6 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#if __ANDROID_API__ >= 9
|
||||
#include "android/asset_manager.h"
|
||||
#include "android/asset_manager_jni.h"
|
||||
#endif
|
||||
|
||||
#include "sherpa-onnx/csrc/file-utils.h"
|
||||
#include "sherpa-onnx/csrc/macros.h"
|
||||
#include "sherpa-onnx/csrc/online-lm.h"
|
||||
@@ -130,8 +125,8 @@ class OnlineRecognizerTransducerImpl : public OnlineRecognizerImpl {
|
||||
}
|
||||
}
|
||||
|
||||
#if __ANDROID_API__ >= 9
|
||||
explicit OnlineRecognizerTransducerImpl(AAssetManager *mgr,
|
||||
template <typename Manager>
|
||||
explicit OnlineRecognizerTransducerImpl(Manager *mgr,
|
||||
const OnlineRecognizerConfig &config)
|
||||
: OnlineRecognizerImpl(mgr, config),
|
||||
config_(config),
|
||||
@@ -178,7 +173,6 @@ class OnlineRecognizerTransducerImpl : public OnlineRecognizerImpl {
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
std::unique_ptr<OnlineStream> CreateStream() const override {
|
||||
auto stream =
|
||||
@@ -429,8 +423,8 @@ class OnlineRecognizerTransducerImpl : public OnlineRecognizerImpl {
|
||||
hotwords_, config_.hotwords_score, boost_scores_);
|
||||
}
|
||||
|
||||
#if __ANDROID_API__ >= 9
|
||||
void InitHotwords(AAssetManager *mgr) {
|
||||
template <typename Manager>
|
||||
void InitHotwords(Manager *mgr) {
|
||||
// each line in hotwords_file contains space-separated words
|
||||
|
||||
auto buf = ReadFile(mgr, config_.hotwords_file);
|
||||
@@ -452,7 +446,6 @@ class OnlineRecognizerTransducerImpl : public OnlineRecognizerImpl {
|
||||
hotwords_graph_ = std::make_shared<ContextGraph>(
|
||||
hotwords_, config_.hotwords_score, boost_scores_);
|
||||
}
|
||||
#endif
|
||||
|
||||
void InitHotwordsFromBufStr() {
|
||||
// each line in hotwords_file contains space-separated words
|
||||
|
||||
Reference in New Issue
Block a user