Add emotion, event of SenseVoice. (#1257)
* Add emotion, event of SenseVoice. * Fix tokens size check and update java api. https://github.com/k2-fsa/sherpa-onnx/pull/1257
This commit is contained in:
@@ -41,7 +41,10 @@ public class OfflineRecognizer {
|
||||
String text = (String) arr[0];
|
||||
String[] tokens = (String[]) arr[1];
|
||||
float[] timestamps = (float[]) arr[2];
|
||||
return new OfflineRecognizerResult(text, tokens, timestamps);
|
||||
String lang = (String) arr[3];
|
||||
String emotion = (String) arr[4];
|
||||
String event = (String) arr[5];
|
||||
return new OfflineRecognizerResult(text, tokens, timestamps, lang, emotion, event);
|
||||
}
|
||||
|
||||
private native void delete(long ptr);
|
||||
|
||||
@@ -6,11 +6,17 @@ public class OfflineRecognizerResult {
|
||||
private final String text;
|
||||
private final String[] tokens;
|
||||
private final float[] timestamps;
|
||||
private final String lang;
|
||||
private final String emotion;
|
||||
private final String event;
|
||||
|
||||
public OfflineRecognizerResult(String text, String[] tokens, float[] timestamps) {
|
||||
public OfflineRecognizerResult(String text, String[] tokens, float[] timestamps, String lang, String emotion, String event) {
|
||||
this.text = text;
|
||||
this.tokens = tokens;
|
||||
this.timestamps = timestamps;
|
||||
this.lang = lang;
|
||||
this.emotion = emotion;
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
@@ -24,4 +30,16 @@ public class OfflineRecognizerResult {
|
||||
public float[] getTimestamps() {
|
||||
return timestamps;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
public String getEmotion() {
|
||||
return emotion;
|
||||
}
|
||||
|
||||
public String getEvent() {
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user