Update c-api.h to hotwords (#962)

This commit is contained in:
9728Lin
2024-06-03 16:26:12 +08:00
committed by GitHub
parent a02e43d83c
commit 9edb78e21b
2 changed files with 20 additions and 0 deletions

View File

@@ -79,6 +79,10 @@ SherpaOnnxOnlineRecognizer *CreateOnlineRecognizer(
SHERPA_ONNX_OR(config->model_config.model_type, ""); SHERPA_ONNX_OR(config->model_config.model_type, "");
recognizer_config.model_config.debug = recognizer_config.model_config.debug =
SHERPA_ONNX_OR(config->model_config.debug, 0); SHERPA_ONNX_OR(config->model_config.debug, 0);
recognizer_config.model_config.modeling_unit =
SHERPA_ONNX_OR(config->model_config.modeling_unit, "cjkchar");
recognizer_config.model_config.bpe_vocab =
SHERPA_ONNX_OR(config->model_config.bpe_vocab, "");
recognizer_config.decoding_method = recognizer_config.decoding_method =
SHERPA_ONNX_OR(config->decoding_method, "greedy_search"); SHERPA_ONNX_OR(config->decoding_method, "greedy_search");
@@ -357,6 +361,10 @@ SherpaOnnxOfflineRecognizer *CreateOfflineRecognizer(
SHERPA_ONNX_OR(config->model_config.provider, "cpu"); SHERPA_ONNX_OR(config->model_config.provider, "cpu");
recognizer_config.model_config.model_type = recognizer_config.model_config.model_type =
SHERPA_ONNX_OR(config->model_config.model_type, ""); SHERPA_ONNX_OR(config->model_config.model_type, "");
recognizer_config.model_config.modeling_unit =
SHERPA_ONNX_OR(config->model_config.modeling_unit, "cjkchar");
recognizer_config.model_config.bpe_vocab =
SHERPA_ONNX_OR(config->model_config.bpe_vocab, "");
recognizer_config.lm_config.model = recognizer_config.lm_config.model =
SHERPA_ONNX_OR(config->lm_config.model, ""); SHERPA_ONNX_OR(config->lm_config.model, "");

View File

@@ -82,6 +82,12 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOnlineModelConfig {
const char *provider; const char *provider;
int32_t debug; // true to print debug information of the model int32_t debug; // true to print debug information of the model
const char *model_type; const char *model_type;
// Valid values:
// - cjkchar
// - bpe
// - cjkchar+bpe
const char *modeling_unit;
const char *bpe_vocab;
} SherpaOnnxOnlineModelConfig; } SherpaOnnxOnlineModelConfig;
/// It expects 16 kHz 16-bit single channel wave format. /// It expects 16 kHz 16-bit single channel wave format.
@@ -383,6 +389,12 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOfflineModelConfig {
int32_t debug; int32_t debug;
const char *provider; const char *provider;
const char *model_type; const char *model_type;
// Valid values:
// - cjkchar
// - bpe
// - cjkchar+bpe
const char *modeling_unit;
const char *bpe_vocab;
} SherpaOnnxOfflineModelConfig; } SherpaOnnxOfflineModelConfig;
SHERPA_ONNX_API typedef struct SherpaOnnxOfflineRecognizerConfig { SHERPA_ONNX_API typedef struct SherpaOnnxOfflineRecognizerConfig {