sherpa-onnx C API 1.0
Public C API and C++ wrapper for sherpa-onnx
Loading...
Searching...
No Matches
SherpaOnnxKeywordSpotterConfig Struct Reference

Configuration for keyword spotting. More...

#include <c-api.h>

Collaboration diagram for SherpaOnnxKeywordSpotterConfig:

Public Attributes

SherpaOnnxFeatureConfig feat_config
SherpaOnnxOnlineModelConfig model_config
int32_t max_active_paths
int32_t num_trailing_blanks
float keywords_score
float keywords_threshold
const char * keywords_file
const char * keywords_buf
int32_t keywords_buf_size

Detailed Description

The acoustic model is configured through model_config. In practice this is usually a streaming transducer model.

Keyword definitions can be provided either through keywords_file or through keywords_buf/keywords_buf_size. If both are set, the buffer is used.

Example using sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile:

memset(&config, 0, sizeof(config));
"./sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile/"
"encoder-epoch-12-avg-2-chunk-16-left-64.int8.onnx";
"./sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile/"
"decoder-epoch-12-avg-2-chunk-16-left-64.onnx";
"./sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile/"
"joiner-epoch-12-avg-2-chunk-16-left-64.int8.onnx";
"./sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile/"
"tokens.txt";
config.model_config.provider = "cpu";
config.keywords_file =
"./sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile/"
"test_wavs/test_keywords.txt";
config.max_active_paths = 4;
config.keywords_score = 3.0f;
config.keywords_threshold = 0.1f;
Configuration for keyword spotting.
Definition c-api.h:1709
SherpaOnnxOnlineModelConfig model_config
Definition c-api.h:1713
const char * provider
Definition c-api.h:258
SherpaOnnxOnlineTransducerModelConfig transducer
Definition c-api.h:248
See also
SherpaOnnxCreateKeywordSpotter

Definition at line 1709 of file c-api.h.

Member Data Documentation

◆ feat_config

SherpaOnnxFeatureConfig SherpaOnnxKeywordSpotterConfig::feat_config

Feature extraction parameters.

Definition at line 1711 of file c-api.h.

◆ keywords_buf

const char* SherpaOnnxKeywordSpotterConfig::keywords_buf

Optional in-memory keyword data. If non-null, it overrides keywords_file.

Definition at line 1726 of file c-api.h.

◆ keywords_buf_size

int32_t SherpaOnnxKeywordSpotterConfig::keywords_buf_size

Size in bytes of keywords_buf, excluding any trailing '\0'.

Definition at line 1728 of file c-api.h.

◆ keywords_file

const char* SherpaOnnxKeywordSpotterConfig::keywords_file

Optional keyword file.

Definition at line 1723 of file c-api.h.

◆ keywords_score

float SherpaOnnxKeywordSpotterConfig::keywords_score

Bonus score applied to keywords during search.

Definition at line 1719 of file c-api.h.

◆ keywords_threshold

float SherpaOnnxKeywordSpotterConfig::keywords_threshold

Detection threshold. Larger values are more conservative.

Definition at line 1721 of file c-api.h.

◆ max_active_paths

int32_t SherpaOnnxKeywordSpotterConfig::max_active_paths

Maximum number of active decoding paths.

Definition at line 1715 of file c-api.h.

◆ model_config

SherpaOnnxOnlineModelConfig SherpaOnnxKeywordSpotterConfig::model_config

Streaming acoustic model configuration.

Definition at line 1713 of file c-api.h.

◆ num_trailing_blanks

int32_t SherpaOnnxKeywordSpotterConfig::num_trailing_blanks

Number of trailing blank symbols required before trigger finalization.

Definition at line 1717 of file c-api.h.


The documentation for this struct was generated from the following file: