Add java api for hotwords (#319)

* Add java api

* support websocket

* Fix kotlin
This commit is contained in:
Wei Kang
2023-09-18 22:44:29 +08:00
committed by GitHub
parent 4dfc11066a
commit d7eab95439
9 changed files with 117 additions and 51 deletions

View File

@@ -49,6 +49,8 @@ public class DecodeFile {
float rule3MinUtteranceLength = 20F;
String decodingMethod = "greedy_search";
int maxActivePaths = 4;
String hotwordsFile = "";
float hotwordsScore = 1.5F;
String lm_model = "";
float lm_scale = 0.5F;
String modelType = "zipformer";
@@ -69,6 +71,8 @@ public class DecodeFile {
lm_model,
lm_scale,
maxActivePaths,
hotwordsFile,
hotwordsScore,
modelType);
streamObj = rcgOjb.createStream();
} catch (Exception e) {
@@ -158,7 +162,7 @@ public class DecodeFile {
try {
String appDir = System.getProperty("user.dir");
System.out.println("appdir=" + appDir);
String fileName = appDir + "/test.wav";
String fileName = appDir + "/" + args[0];
String cfgPath = appDir + "/modeltest.cfg";
String soPath = appDir + "/../build/lib/libsherpa-onnx-jni.so";
OnlineRecognizer.setSoPath(soPath);