Skip to content

Commit 9edb78e

Browse files
authored
Update c-api.h to hotwords (#962)
1 parent a02e43d commit 9edb78e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

sherpa-onnx/c-api/c-api.cc

+8
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ SherpaOnnxOnlineRecognizer *CreateOnlineRecognizer(
7979
SHERPA_ONNX_OR(config->model_config.model_type, "");
8080
recognizer_config.model_config.debug =
8181
SHERPA_ONNX_OR(config->model_config.debug, 0);
82+
recognizer_config.model_config.modeling_unit =
83+
SHERPA_ONNX_OR(config->model_config.modeling_unit, "cjkchar");
84+
recognizer_config.model_config.bpe_vocab =
85+
SHERPA_ONNX_OR(config->model_config.bpe_vocab, "");
8286

8387
recognizer_config.decoding_method =
8488
SHERPA_ONNX_OR(config->decoding_method, "greedy_search");
@@ -357,6 +361,10 @@ SherpaOnnxOfflineRecognizer *CreateOfflineRecognizer(
357361
SHERPA_ONNX_OR(config->model_config.provider, "cpu");
358362
recognizer_config.model_config.model_type =
359363
SHERPA_ONNX_OR(config->model_config.model_type, "");
364+
recognizer_config.model_config.modeling_unit =
365+
SHERPA_ONNX_OR(config->model_config.modeling_unit, "cjkchar");
366+
recognizer_config.model_config.bpe_vocab =
367+
SHERPA_ONNX_OR(config->model_config.bpe_vocab, "");
360368

361369
recognizer_config.lm_config.model =
362370
SHERPA_ONNX_OR(config->lm_config.model, "");

sherpa-onnx/c-api/c-api.h

+12
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOnlineModelConfig {
8282
const char *provider;
8383
int32_t debug; // true to print debug information of the model
8484
const char *model_type;
85+
// Valid values:
86+
// - cjkchar
87+
// - bpe
88+
// - cjkchar+bpe
89+
const char *modeling_unit;
90+
const char *bpe_vocab;
8591
} SherpaOnnxOnlineModelConfig;
8692

8793
/// It expects 16 kHz 16-bit single channel wave format.
@@ -383,6 +389,12 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOfflineModelConfig {
383389
int32_t debug;
384390
const char *provider;
385391
const char *model_type;
392+
// Valid values:
393+
// - cjkchar
394+
// - bpe
395+
// - cjkchar+bpe
396+
const char *modeling_unit;
397+
const char *bpe_vocab;
386398
} SherpaOnnxOfflineModelConfig;
387399

388400
SHERPA_ONNX_API typedef struct SherpaOnnxOfflineRecognizerConfig {

0 commit comments

Comments
 (0)