diff --git a/cmake/cmake_extension.py b/cmake/cmake_extension.py index b207a4171..46116f5c5 100644 --- a/cmake/cmake_extension.py +++ b/cmake/cmake_extension.py @@ -80,6 +80,7 @@ def get_binaries(): "kaldi-decoder-core.dll", "kaldi-native-fbank-core.dll", "onnxruntime.dll", + "ssentencepiece_core.dll", "piper_phonemize.dll", "sherpa-onnx-c-api.dll", "sherpa-onnx-core.dll", diff --git a/cmake/sherpa-onnx-no-tts.pc.in b/cmake/sherpa-onnx-no-tts.pc.in index 4637b6ca4..0b020e43c 100644 --- a/cmake/sherpa-onnx-no-tts.pc.in +++ b/cmake/sherpa-onnx-no-tts.pc.in @@ -13,4 +13,4 @@ Cflags: -I"${includedir}" # Note: -lcargs is required only for the following file # https://github.com/k2-fsa/sherpa-onnx/blob/master/c-api-examples/decode-file-c-api.c # We add it here so that users don't need to specify -lcargs when compiling decode-file-c-api.c -Libs: -L"${libdir}" -lsherpa-onnx-c-api -lsherpa-onnx-core -lkaldi-decoder-core -lsherpa-onnx-kaldifst-core -lsherpa-onnx-fst -lkaldi-native-fbank-core -lonnxruntime -Wl,-rpath,${libdir} @SHERPA_ONNX_PKG_WITH_CARGS@ @SHERPA_ONNX_PKG_CONFIG_EXTRA_LIBS@ +Libs: -L"${libdir}" -lsherpa-onnx-c-api -lsherpa-onnx-core -lkaldi-decoder-core -lsherpa-onnx-kaldifst-core -lsherpa-onnx-fst -lkaldi-native-fbank-core -lonnxruntime -lssentencepiece_core -Wl,-rpath,${libdir} @SHERPA_ONNX_PKG_WITH_CARGS@ @SHERPA_ONNX_PKG_CONFIG_EXTRA_LIBS@ diff --git a/cmake/sherpa-onnx.pc.in b/cmake/sherpa-onnx.pc.in index fd37eeeb3..87b929a44 100644 --- a/cmake/sherpa-onnx.pc.in +++ b/cmake/sherpa-onnx.pc.in @@ -13,4 +13,4 @@ Cflags: -I"${includedir}" # Note: -lcargs is required only for the following file # https://github.com/k2-fsa/sherpa-onnx/blob/master/c-api-examples/decode-file-c-api.c # We add it here so that users don't need to specify -lcargs when compiling decode-file-c-api.c -Libs: -L"${libdir}" -lsherpa-onnx-c-api -lsherpa-onnx-core -lkaldi-decoder-core -lsherpa-onnx-kaldifst-core -lsherpa-onnx-fstfar -lsherpa-onnx-fst -lkaldi-native-fbank-core -lpiper_phonemize -lespeak-ng -lucd -lonnxruntime -Wl,-rpath,${libdir} @SHERPA_ONNX_PKG_WITH_CARGS@ @SHERPA_ONNX_PKG_CONFIG_EXTRA_LIBS@ +Libs: -L"${libdir}" -lsherpa-onnx-c-api -lsherpa-onnx-core -lkaldi-decoder-core -lsherpa-onnx-kaldifst-core -lsherpa-onnx-fstfar -lsherpa-onnx-fst -lkaldi-native-fbank-core -lpiper_phonemize -lespeak-ng -lucd -lonnxruntime -lssentencepiece_core -Wl,-rpath,${libdir} @SHERPA_ONNX_PKG_WITH_CARGS@ @SHERPA_ONNX_PKG_CONFIG_EXTRA_LIBS@ diff --git a/sherpa-onnx/csrc/offline-recognizer-paraformer-impl.h b/sherpa-onnx/csrc/offline-recognizer-paraformer-impl.h index 3c96f03bc..3bcaf390b 100644 --- a/sherpa-onnx/csrc/offline-recognizer-paraformer-impl.h +++ b/sherpa-onnx/csrc/offline-recognizer-paraformer-impl.h @@ -59,9 +59,9 @@ static OfflineRecognitionResult Convert( mergeable = false; if (i > 0) { - const uint8_t *p = reinterpret_cast( - sym_table[src.tokens[i - 1]].c_str()); - if (p[0] < 0x80) { + const uint8_t p = reinterpret_cast( + sym_table[src.tokens[i - 1]].c_str())[0]; + if (p < 0x80) { // put a space between ascii and non-ascii text.append(" "); } 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; + } } }