正在显示
2 个修改的文件
包含
20 行增加
和
0 行删除
| @@ -79,6 +79,10 @@ SherpaOnnxOnlineRecognizer *CreateOnlineRecognizer( | @@ -79,6 +79,10 @@ SherpaOnnxOnlineRecognizer *CreateOnlineRecognizer( | ||
| 79 | SHERPA_ONNX_OR(config->model_config.model_type, ""); | 79 | SHERPA_ONNX_OR(config->model_config.model_type, ""); |
| 80 | recognizer_config.model_config.debug = | 80 | recognizer_config.model_config.debug = |
| 81 | SHERPA_ONNX_OR(config->model_config.debug, 0); | 81 | 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, ""); | ||
| 82 | 86 | ||
| 83 | recognizer_config.decoding_method = | 87 | recognizer_config.decoding_method = |
| 84 | SHERPA_ONNX_OR(config->decoding_method, "greedy_search"); | 88 | SHERPA_ONNX_OR(config->decoding_method, "greedy_search"); |
| @@ -357,6 +361,10 @@ SherpaOnnxOfflineRecognizer *CreateOfflineRecognizer( | @@ -357,6 +361,10 @@ SherpaOnnxOfflineRecognizer *CreateOfflineRecognizer( | ||
| 357 | SHERPA_ONNX_OR(config->model_config.provider, "cpu"); | 361 | SHERPA_ONNX_OR(config->model_config.provider, "cpu"); |
| 358 | recognizer_config.model_config.model_type = | 362 | recognizer_config.model_config.model_type = |
| 359 | SHERPA_ONNX_OR(config->model_config.model_type, ""); | 363 | 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, ""); | ||
| 360 | 368 | ||
| 361 | recognizer_config.lm_config.model = | 369 | recognizer_config.lm_config.model = |
| 362 | SHERPA_ONNX_OR(config->lm_config.model, ""); | 370 | SHERPA_ONNX_OR(config->lm_config.model, ""); |
| @@ -82,6 +82,12 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOnlineModelConfig { | @@ -82,6 +82,12 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOnlineModelConfig { | ||
| 82 | const char *provider; | 82 | const char *provider; |
| 83 | int32_t debug; // true to print debug information of the model | 83 | int32_t debug; // true to print debug information of the model |
| 84 | const char *model_type; | 84 | const char *model_type; |
| 85 | + // Valid values: | ||
| 86 | + // - cjkchar | ||
| 87 | + // - bpe | ||
| 88 | + // - cjkchar+bpe | ||
| 89 | + const char *modeling_unit; | ||
| 90 | + const char *bpe_vocab; | ||
| 85 | } SherpaOnnxOnlineModelConfig; | 91 | } SherpaOnnxOnlineModelConfig; |
| 86 | 92 | ||
| 87 | /// It expects 16 kHz 16-bit single channel wave format. | 93 | /// It expects 16 kHz 16-bit single channel wave format. |
| @@ -383,6 +389,12 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOfflineModelConfig { | @@ -383,6 +389,12 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOfflineModelConfig { | ||
| 383 | int32_t debug; | 389 | int32_t debug; |
| 384 | const char *provider; | 390 | const char *provider; |
| 385 | const char *model_type; | 391 | const char *model_type; |
| 392 | + // Valid values: | ||
| 393 | + // - cjkchar | ||
| 394 | + // - bpe | ||
| 395 | + // - cjkchar+bpe | ||
| 396 | + const char *modeling_unit; | ||
| 397 | + const char *bpe_vocab; | ||
| 386 | } SherpaOnnxOfflineModelConfig; | 398 | } SherpaOnnxOfflineModelConfig; |
| 387 | 399 | ||
| 388 | SHERPA_ONNX_API typedef struct SherpaOnnxOfflineRecognizerConfig { | 400 | SHERPA_ONNX_API typedef struct SherpaOnnxOfflineRecognizerConfig { |
-
请 注册 或 登录 后发表评论