Add Java and Kotlin API for sense voice (#1164)
This commit is contained in:
@@ -7,6 +7,7 @@ public class OfflineModelConfig {
|
||||
private final OfflineParaformerModelConfig paraformer;
|
||||
private final OfflineWhisperModelConfig whisper;
|
||||
private final OfflineNemoEncDecCtcModelConfig nemo;
|
||||
private final OfflineSenseVoiceModelConfig senseVoice;
|
||||
private final String teleSpeech;
|
||||
private final String tokens;
|
||||
private final int numThreads;
|
||||
@@ -22,6 +23,7 @@ public class OfflineModelConfig {
|
||||
this.paraformer = builder.paraformer;
|
||||
this.whisper = builder.whisper;
|
||||
this.nemo = builder.nemo;
|
||||
this.senseVoice = builder.senseVoice;
|
||||
this.teleSpeech = builder.teleSpeech;
|
||||
this.tokens = builder.tokens;
|
||||
this.numThreads = builder.numThreads;
|
||||
@@ -48,6 +50,10 @@ public class OfflineModelConfig {
|
||||
return whisper;
|
||||
}
|
||||
|
||||
public OfflineSenseVoiceModelConfig getSenseVoice() {
|
||||
return senseVoice;
|
||||
}
|
||||
|
||||
public String getTokens() {
|
||||
return tokens;
|
||||
}
|
||||
@@ -85,6 +91,7 @@ public class OfflineModelConfig {
|
||||
private OfflineTransducerModelConfig transducer = OfflineTransducerModelConfig.builder().build();
|
||||
private OfflineWhisperModelConfig whisper = OfflineWhisperModelConfig.builder().build();
|
||||
private OfflineNemoEncDecCtcModelConfig nemo = OfflineNemoEncDecCtcModelConfig.builder().build();
|
||||
private OfflineSenseVoiceModelConfig senseVoice = OfflineSenseVoiceModelConfig.builder().build();
|
||||
private String teleSpeech = "";
|
||||
private String tokens = "";
|
||||
private int numThreads = 1;
|
||||
@@ -113,7 +120,6 @@ public class OfflineModelConfig {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Builder setTeleSpeech(String teleSpeech) {
|
||||
this.teleSpeech = teleSpeech;
|
||||
return this;
|
||||
@@ -124,6 +130,11 @@ public class OfflineModelConfig {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setSenseVoice(OfflineSenseVoiceModelConfig senseVoice) {
|
||||
this.senseVoice = senseVoice;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setTokens(String tokens) {
|
||||
this.tokens = tokens;
|
||||
return this;
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
// Copyright 2024 Xiaomi Corporation
|
||||
|
||||
package com.k2fsa.sherpa.onnx;
|
||||
|
||||
public class OfflineSenseVoiceModelConfig {
|
||||
private final String model;
|
||||
private final String language;
|
||||
private final boolean useInverseTextNormalization;
|
||||
|
||||
private OfflineSenseVoiceModelConfig(Builder builder) {
|
||||
this.model = builder.model;
|
||||
this.language = builder.language;
|
||||
this.useInverseTextNormalization = builder.useInverseTextNormalization;
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public boolean getUseInverseTextNormalization() {
|
||||
return useInverseTextNormalization;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String model = "";
|
||||
private String language = "";
|
||||
private boolean useInverseTextNormalization = true;
|
||||
|
||||
public OfflineSenseVoiceModelConfig build() {
|
||||
return new OfflineSenseVoiceModelConfig(this);
|
||||
}
|
||||
|
||||
public Builder setModel(String model) {
|
||||
this.model = model;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setLanguage(String language) {
|
||||
this.language = language;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setInverseTextNormalization(boolean useInverseTextNormalization) {
|
||||
this.useInverseTextNormalization = useInverseTextNormalization;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user