diff --git a/sherpa-onnx/java-api/src/com/k2fsa/sherpa/onnx/OfflineModelConfig.java b/sherpa-onnx/java-api/src/com/k2fsa/sherpa/onnx/OfflineModelConfig.java index 23164f66d..c7eba0237 100644 --- a/sherpa-onnx/java-api/src/com/k2fsa/sherpa/onnx/OfflineModelConfig.java +++ b/sherpa-onnx/java-api/src/com/k2fsa/sherpa/onnx/OfflineModelConfig.java @@ -13,6 +13,8 @@ public class OfflineModelConfig { private final String provider; private final String modelType; + private final String modelingUnit; + private final String bpeVocab; private OfflineModelConfig(Builder builder) { this.transducer = builder.transducer; @@ -24,6 +26,8 @@ private OfflineModelConfig(Builder builder) { this.debug = builder.debug; this.provider = builder.provider; this.modelType = builder.modelType; + this.modelingUnit = builder.modelingUnit; + this.bpeVocab = builder.bpeVocab; } public static Builder builder() { @@ -62,6 +66,13 @@ public String getModelType() { return modelType; } + public String getModelingUnit() { + return modelingUnit; + } + + public String getBpeVocab() { + return bpeVocab; + } public static class Builder { private OfflineParaformerModelConfig paraformer = OfflineParaformerModelConfig.builder().build(); @@ -73,6 +84,8 @@ public static class Builder { private boolean debug = true; private String provider = "cpu"; private String modelType = ""; + private String modelingUnit = "cjkchar"; + private String bpeVocab = ""; public OfflineModelConfig build() { return new OfflineModelConfig(this); @@ -122,5 +135,13 @@ public Builder setModelType(String modelType) { this.modelType = modelType; return this; } + + public void setModelingUnit(String modelingUnit) { + this.modelingUnit = modelingUnit; + } + + public void setBpeVocab(String bpeVocab) { + this.bpeVocab = bpeVocab; + } } } \ No newline at end of file diff --git a/sherpa-onnx/java-api/src/com/k2fsa/sherpa/onnx/OnlineModelConfig.java b/sherpa-onnx/java-api/src/com/k2fsa/sherpa/onnx/OnlineModelConfig.java index a833b7cd1..3cff42d9d 100644 --- a/sherpa-onnx/java-api/src/com/k2fsa/sherpa/onnx/OnlineModelConfig.java +++ b/sherpa-onnx/java-api/src/com/k2fsa/sherpa/onnx/OnlineModelConfig.java @@ -13,6 +13,8 @@ public class OnlineModelConfig { private final boolean debug; private final String provider; private final String modelType; + private final String modelingUnit; + private final String bpeVocab; private OnlineModelConfig(Builder builder) { this.transducer = builder.transducer; @@ -24,6 +26,8 @@ private OnlineModelConfig(Builder builder) { this.debug = builder.debug; this.provider = builder.provider; this.modelType = builder.modelType; + this.modelingUnit = builder.modelingUnit; + this.bpeVocab = builder.bpeVocab; } public static Builder builder() { @@ -66,6 +70,14 @@ public String getModelType() { return modelType; } + public String getModelingUnit() { + return modelingUnit; + } + + public String getBpeVocab() { + return bpeVocab; + } + public static class Builder { private OnlineParaformerModelConfig paraformer = OnlineParaformerModelConfig.builder().build(); private OnlineTransducerModelConfig transducer = OnlineTransducerModelConfig.builder().build(); @@ -76,6 +88,8 @@ public static class Builder { private boolean debug = true; private String provider = "cpu"; private String modelType = ""; + private String modelingUnit = "cjkchar"; + private String bpeVocab = ""; public OnlineModelConfig build() { return new OnlineModelConfig(this); @@ -125,5 +139,13 @@ public Builder setModelType(String modelType) { this.modelType = modelType; return this; } + + public void setModelingUnit(String modelingUnit) { + this.modelingUnit = modelingUnit; + } + + public void setBpeVocab(String bpeVocab) { + this.bpeVocab = bpeVocab; + } } }