Add C and CXX API for homophone replacer (#2156)

This commit is contained in:
Fangjun Kuang
2025-04-27 22:09:13 +08:00
committed by GitHub
parent f64c58342b
commit e51c37eb2f
13 changed files with 586 additions and 1 deletions

View File

@@ -112,6 +112,12 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOnlineCtcFstDecoderConfig {
int32_t max_active;
} SherpaOnnxOnlineCtcFstDecoderConfig;
SHERPA_ONNX_API typedef struct SherpaOnnxHomophoneReplacerConfig {
const char *dict_dir;
const char *lexicon;
const char *rule_fsts;
} SherpaOnnxHomophoneReplacerConfig;
SHERPA_ONNX_API typedef struct SherpaOnnxOnlineRecognizerConfig {
SherpaOnnxFeatureConfig feat_config;
SherpaOnnxOnlineModelConfig model_config;
@@ -157,6 +163,7 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOnlineRecognizerConfig {
const char *hotwords_buf;
/// byte size excluding the tailing '\0'
int32_t hotwords_buf_size;
SherpaOnnxHomophoneReplacerConfig hr;
} SherpaOnnxOnlineRecognizerConfig;
SHERPA_ONNX_API typedef struct SherpaOnnxOnlineRecognizerResult {
@@ -461,6 +468,8 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOfflineRecognizerConfig {
const char *rule_fsts;
const char *rule_fars;
float blank_penalty;
SherpaOnnxHomophoneReplacerConfig hr;
} SherpaOnnxOfflineRecognizerConfig;
SHERPA_ONNX_API typedef struct SherpaOnnxOfflineRecognizer