Add Java and Kotlin API for punctuation models (#818)
This commit is contained in:
@@ -4,6 +4,11 @@
|
||||
|
||||
#include "sherpa-onnx/csrc/offline-punctuation-impl.h"
|
||||
|
||||
#if __ANDROID_API__ >= 9
|
||||
#include "android/asset_manager.h"
|
||||
#include "android/asset_manager_jni.h"
|
||||
#endif
|
||||
|
||||
#include "sherpa-onnx/csrc/macros.h"
|
||||
#include "sherpa-onnx/csrc/offline-punctuation-ct-transformer-impl.h"
|
||||
|
||||
@@ -19,4 +24,16 @@ std::unique_ptr<OfflinePunctuationImpl> OfflinePunctuationImpl::Create(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if __ANDROID_API__ >= 9
|
||||
std::unique_ptr<OfflinePunctuationImpl> OfflinePunctuationImpl::Create(
|
||||
AAssetManager *mgr, const OfflinePunctuationConfig &config) {
|
||||
if (!config.model.ct_transformer.empty()) {
|
||||
return std::make_unique<OfflinePunctuationCtTransformerImpl>(mgr, config);
|
||||
}
|
||||
|
||||
SHERPA_ONNX_LOGE("Please specify a punctuation model! Return a null pointer");
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace sherpa_onnx
|
||||
|
||||
Reference in New Issue
Block a user