Fangjun Kuang
Committed by GitHub

Fix CI tests. (#907)

@@ -80,6 +80,7 @@ def get_binaries(): @@ -80,6 +80,7 @@ def get_binaries():
80 "kaldi-decoder-core.dll", 80 "kaldi-decoder-core.dll",
81 "kaldi-native-fbank-core.dll", 81 "kaldi-native-fbank-core.dll",
82 "onnxruntime.dll", 82 "onnxruntime.dll",
  83 + "ssentencepiece_core.dll",
83 "piper_phonemize.dll", 84 "piper_phonemize.dll",
84 "sherpa-onnx-c-api.dll", 85 "sherpa-onnx-c-api.dll",
85 "sherpa-onnx-core.dll", 86 "sherpa-onnx-core.dll",
@@ -13,4 +13,4 @@ Cflags: -I"${includedir}" @@ -13,4 +13,4 @@ Cflags: -I"${includedir}"
13 # Note: -lcargs is required only for the following file 13 # Note: -lcargs is required only for the following file
14 # https://github.com/k2-fsa/sherpa-onnx/blob/master/c-api-examples/decode-file-c-api.c 14 # https://github.com/k2-fsa/sherpa-onnx/blob/master/c-api-examples/decode-file-c-api.c
15 # We add it here so that users don't need to specify -lcargs when compiling decode-file-c-api.c 15 # We add it here so that users don't need to specify -lcargs when compiling decode-file-c-api.c
16 -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@ 16 +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@
@@ -13,4 +13,4 @@ Cflags: -I"${includedir}" @@ -13,4 +13,4 @@ Cflags: -I"${includedir}"
13 # Note: -lcargs is required only for the following file 13 # Note: -lcargs is required only for the following file
14 # https://github.com/k2-fsa/sherpa-onnx/blob/master/c-api-examples/decode-file-c-api.c 14 # https://github.com/k2-fsa/sherpa-onnx/blob/master/c-api-examples/decode-file-c-api.c
15 # We add it here so that users don't need to specify -lcargs when compiling decode-file-c-api.c 15 # We add it here so that users don't need to specify -lcargs when compiling decode-file-c-api.c
16 -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@ 16 +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@
@@ -59,9 +59,9 @@ static OfflineRecognitionResult Convert( @@ -59,9 +59,9 @@ static OfflineRecognitionResult Convert(
59 mergeable = false; 59 mergeable = false;
60 60
61 if (i > 0) { 61 if (i > 0) {
62 - const uint8_t *p = reinterpret_cast<const uint8_t *>(  
63 - sym_table[src.tokens[i - 1]].c_str());  
64 - if (p[0] < 0x80) { 62 + const uint8_t p = reinterpret_cast<const uint8_t *>(
  63 + sym_table[src.tokens[i - 1]].c_str())[0];
  64 + if (p < 0x80) {
65 // put a space between ascii and non-ascii 65 // put a space between ascii and non-ascii
66 text.append(" "); 66 text.append(" ");
67 } 67 }
@@ -13,6 +13,8 @@ public class OfflineModelConfig { @@ -13,6 +13,8 @@ public class OfflineModelConfig {
13 private final String provider; 13 private final String provider;
14 14
15 private final String modelType; 15 private final String modelType;
  16 + private final String modelingUnit;
  17 + private final String bpeVocab;
16 18
17 private OfflineModelConfig(Builder builder) { 19 private OfflineModelConfig(Builder builder) {
18 this.transducer = builder.transducer; 20 this.transducer = builder.transducer;
@@ -24,6 +26,8 @@ public class OfflineModelConfig { @@ -24,6 +26,8 @@ public class OfflineModelConfig {
24 this.debug = builder.debug; 26 this.debug = builder.debug;
25 this.provider = builder.provider; 27 this.provider = builder.provider;
26 this.modelType = builder.modelType; 28 this.modelType = builder.modelType;
  29 + this.modelingUnit = builder.modelingUnit;
  30 + this.bpeVocab = builder.bpeVocab;
27 } 31 }
28 32
29 public static Builder builder() { 33 public static Builder builder() {
@@ -62,6 +66,13 @@ public class OfflineModelConfig { @@ -62,6 +66,13 @@ public class OfflineModelConfig {
62 return modelType; 66 return modelType;
63 } 67 }
64 68
  69 + public String getModelingUnit() {
  70 + return modelingUnit;
  71 + }
  72 +
  73 + public String getBpeVocab() {
  74 + return bpeVocab;
  75 + }
65 76
66 public static class Builder { 77 public static class Builder {
67 private OfflineParaformerModelConfig paraformer = OfflineParaformerModelConfig.builder().build(); 78 private OfflineParaformerModelConfig paraformer = OfflineParaformerModelConfig.builder().build();
@@ -73,6 +84,8 @@ public class OfflineModelConfig { @@ -73,6 +84,8 @@ public class OfflineModelConfig {
73 private boolean debug = true; 84 private boolean debug = true;
74 private String provider = "cpu"; 85 private String provider = "cpu";
75 private String modelType = ""; 86 private String modelType = "";
  87 + private String modelingUnit = "cjkchar";
  88 + private String bpeVocab = "";
76 89
77 public OfflineModelConfig build() { 90 public OfflineModelConfig build() {
78 return new OfflineModelConfig(this); 91 return new OfflineModelConfig(this);
@@ -122,5 +135,13 @@ public class OfflineModelConfig { @@ -122,5 +135,13 @@ public class OfflineModelConfig {
122 this.modelType = modelType; 135 this.modelType = modelType;
123 return this; 136 return this;
124 } 137 }
  138 +
  139 + public void setModelingUnit(String modelingUnit) {
  140 + this.modelingUnit = modelingUnit;
  141 + }
  142 +
  143 + public void setBpeVocab(String bpeVocab) {
  144 + this.bpeVocab = bpeVocab;
  145 + }
125 } 146 }
126 } 147 }
@@ -13,6 +13,8 @@ public class OnlineModelConfig { @@ -13,6 +13,8 @@ public class OnlineModelConfig {
13 private final boolean debug; 13 private final boolean debug;
14 private final String provider; 14 private final String provider;
15 private final String modelType; 15 private final String modelType;
  16 + private final String modelingUnit;
  17 + private final String bpeVocab;
16 18
17 private OnlineModelConfig(Builder builder) { 19 private OnlineModelConfig(Builder builder) {
18 this.transducer = builder.transducer; 20 this.transducer = builder.transducer;
@@ -24,6 +26,8 @@ public class OnlineModelConfig { @@ -24,6 +26,8 @@ public class OnlineModelConfig {
24 this.debug = builder.debug; 26 this.debug = builder.debug;
25 this.provider = builder.provider; 27 this.provider = builder.provider;
26 this.modelType = builder.modelType; 28 this.modelType = builder.modelType;
  29 + this.modelingUnit = builder.modelingUnit;
  30 + this.bpeVocab = builder.bpeVocab;
27 } 31 }
28 32
29 public static Builder builder() { 33 public static Builder builder() {
@@ -66,6 +70,14 @@ public class OnlineModelConfig { @@ -66,6 +70,14 @@ public class OnlineModelConfig {
66 return modelType; 70 return modelType;
67 } 71 }
68 72
  73 + public String getModelingUnit() {
  74 + return modelingUnit;
  75 + }
  76 +
  77 + public String getBpeVocab() {
  78 + return bpeVocab;
  79 + }
  80 +
69 public static class Builder { 81 public static class Builder {
70 private OnlineParaformerModelConfig paraformer = OnlineParaformerModelConfig.builder().build(); 82 private OnlineParaformerModelConfig paraformer = OnlineParaformerModelConfig.builder().build();
71 private OnlineTransducerModelConfig transducer = OnlineTransducerModelConfig.builder().build(); 83 private OnlineTransducerModelConfig transducer = OnlineTransducerModelConfig.builder().build();
@@ -76,6 +88,8 @@ public class OnlineModelConfig { @@ -76,6 +88,8 @@ public class OnlineModelConfig {
76 private boolean debug = true; 88 private boolean debug = true;
77 private String provider = "cpu"; 89 private String provider = "cpu";
78 private String modelType = ""; 90 private String modelType = "";
  91 + private String modelingUnit = "cjkchar";
  92 + private String bpeVocab = "";
79 93
80 public OnlineModelConfig build() { 94 public OnlineModelConfig build() {
81 return new OnlineModelConfig(this); 95 return new OnlineModelConfig(this);
@@ -125,5 +139,13 @@ public class OnlineModelConfig { @@ -125,5 +139,13 @@ public class OnlineModelConfig {
125 this.modelType = modelType; 139 this.modelType = modelType;
126 return this; 140 return this;
127 } 141 }
  142 +
  143 + public void setModelingUnit(String modelingUnit) {
  144 + this.modelingUnit = modelingUnit;
  145 + }
  146 +
  147 + public void setBpeVocab(String bpeVocab) {
  148 + this.bpeVocab = bpeVocab;
  149 + }
128 } 150 }
129 } 151 }