Support c-api (#317)
This commit is contained in:
@@ -80,6 +80,10 @@ SherpaOnnxOnlineRecognizer *CreateOnlineRecognizer(
|
||||
recognizer_config.endpoint_config.rule3.min_utterance_length =
|
||||
SHERPA_ONNX_OR(config->rule3_min_utterance_length, 20);
|
||||
|
||||
recognizer_config.hotwords_file = SHERPA_ONNX_OR(config->hotwords_file, "");
|
||||
recognizer_config.hotwords_score =
|
||||
SHERPA_ONNX_OR(config->hotwords_score, 1.5);
|
||||
|
||||
if (config->model_config.debug) {
|
||||
fprintf(stderr, "%s\n", recognizer_config.ToString().c_str());
|
||||
}
|
||||
@@ -297,6 +301,10 @@ SherpaOnnxOfflineRecognizer *CreateOfflineRecognizer(
|
||||
recognizer_config.max_active_paths =
|
||||
SHERPA_ONNX_OR(config->max_active_paths, 4);
|
||||
|
||||
recognizer_config.hotwords_file = SHERPA_ONNX_OR(config->hotwords_file, "");
|
||||
recognizer_config.hotwords_score =
|
||||
SHERPA_ONNX_OR(config->hotwords_score, 1.5);
|
||||
|
||||
if (config->model_config.debug) {
|
||||
fprintf(stderr, "%s\n", recognizer_config.ToString().c_str());
|
||||
}
|
||||
|
||||
@@ -111,6 +111,12 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOnlineRecognizerConfig {
|
||||
/// this value.
|
||||
/// Used only when enable_endpoint is not 0.
|
||||
float rule3_min_utterance_length;
|
||||
|
||||
/// Path to the hotwords.
|
||||
const char *hotwords_file;
|
||||
|
||||
/// Bonus score for each token in hotwords.
|
||||
float hotwords_score;
|
||||
} SherpaOnnxOnlineRecognizerConfig;
|
||||
|
||||
SHERPA_ONNX_API typedef struct SherpaOnnxOnlineRecognizerResult {
|
||||
@@ -335,6 +341,12 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOfflineRecognizerConfig {
|
||||
|
||||
const char *decoding_method;
|
||||
int32_t max_active_paths;
|
||||
|
||||
/// Path to the hotwords.
|
||||
const char *hotwords_file;
|
||||
|
||||
/// Bonus score for each token in hotwords.
|
||||
float hotwords_score;
|
||||
} SherpaOnnxOfflineRecognizerConfig;
|
||||
|
||||
SHERPA_ONNX_API typedef struct SherpaOnnxOfflineRecognizer
|
||||
|
||||
Reference in New Issue
Block a user