sherpa-onnx supports both offline and online punctuation restoration.
- See also
- SherpaOnnxCreateOfflinePunctuation, SherpaOnnxCreateOnlinePunctuation
Offline Punctuation
Offline punctuation processes the entire input text at once using a CT-Transformer model.
memset(&config, 0, sizeof(config));
"./sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8/model.int8.onnx";
punct, "how are you i am fine thank you");
printf("%s\n", result);
const char * SherpaOfflinePunctuationAddPunct(const SherpaOnnxOfflinePunctuation *punct, const char *text)
Add punctuation to a complete input text.
void SherpaOfflinePunctuationFreeText(const char *text)
Free a string returned by SherpaOfflinePunctuationAddPunct().
void SherpaOnnxDestroyOfflinePunctuation(const SherpaOnnxOfflinePunctuation *punct)
Destroy an offline punctuation processor.
struct SherpaOnnxOfflinePunctuation SherpaOnnxOfflinePunctuation
Opaque offline punctuation handle.
const SherpaOnnxOfflinePunctuation * SherpaOnnxCreateOfflinePunctuation(const SherpaOnnxOfflinePunctuationConfig *config)
Create an offline punctuation processor.
Configuration for offline punctuation.
SherpaOnnxOfflinePunctuationModelConfig model
const char * ct_transformer
Model package: sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8
Example source: add-punctuation-c-api.c
Online Punctuation
Online punctuation processes text incrementally using a CNN-BiLSTM model.
memset(&config, 0, sizeof(config));
"./sherpa-onnx-online-punct-en-2024-08-06/model.int8.onnx";
"./sherpa-onnx-online-punct-en-2024-08-06/bpe.vocab";
punct, "how are you i am fine thank you");
printf("%s\n", out);
const char * SherpaOnnxOnlinePunctuationAddPunct(const SherpaOnnxOnlinePunctuation *punctuation, const char *text)
Add punctuation to one text chunk using the online punctuation model.
void SherpaOnnxOnlinePunctuationFreeText(const char *text)
Free a string returned by SherpaOnnxOnlinePunctuationAddPunct().
const SherpaOnnxOnlinePunctuation * SherpaOnnxCreateOnlinePunctuation(const SherpaOnnxOnlinePunctuationConfig *config)
Create an online punctuation processor.
struct SherpaOnnxOnlinePunctuation SherpaOnnxOnlinePunctuation
Opaque online punctuation handle.
void SherpaOnnxDestroyOnlinePunctuation(const SherpaOnnxOnlinePunctuation *punctuation)
Destroy an online punctuation processor.
Configuration for online punctuation.
SherpaOnnxOnlinePunctuationModelConfig model
Model package: sherpa-onnx-online-punct-en-2024-08-06
Example source: add-punctuation-online-c-api.c