Add Go API examples for adding punctuations to text. (#1478)
This commit is contained in:
5
scripts/go/_internal/add-punctuation/go.mod
Normal file
5
scripts/go/_internal/add-punctuation/go.mod
Normal file
@@ -0,0 +1,5 @@
|
||||
module add-punctuation
|
||||
|
||||
go 1.12
|
||||
|
||||
replace github.com/k2-fsa/sherpa-onnx-go/sherpa_onnx => ../
|
||||
1
scripts/go/_internal/add-punctuation/main.go
Symbolic link
1
scripts/go/_internal/add-punctuation/main.go
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../go-api-examples/add-punctuation/main.go
|
||||
1
scripts/go/_internal/add-punctuation/run.sh
Symbolic link
1
scripts/go/_internal/add-punctuation/run.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../go-api-examples/add-punctuation/run.sh
|
||||
@@ -1322,10 +1322,10 @@ func (sd *OfflineSpeakerDiarization) Process(samples []float32) []OfflineSpeaker
|
||||
// For punctuation
|
||||
// ============================================================
|
||||
type OfflinePunctuationModelConfig struct {
|
||||
Ct_transformer string
|
||||
Num_threads C.int
|
||||
Debug C.int // true to print debug information of the model
|
||||
Provider string
|
||||
CtTransformer string
|
||||
NumThreads C.int
|
||||
Debug C.int // true to print debug information of the model
|
||||
Provider string
|
||||
}
|
||||
|
||||
type OfflinePunctuationConfig struct {
|
||||
@@ -1338,10 +1338,10 @@ type OfflinePunctuation struct {
|
||||
|
||||
func NewOfflinePunctuation(config *OfflinePunctuationConfig) *OfflinePunctuation {
|
||||
cfg := C.struct_SherpaOnnxOfflinePunctuationConfig{}
|
||||
cfg.model.ct_transformer = C.CString(config.Model.Ct_transformer)
|
||||
cfg.model.ct_transformer = C.CString(config.Model.CtTransformer)
|
||||
defer C.free(unsafe.Pointer(cfg.model.ct_transformer))
|
||||
|
||||
cfg.model.num_threads = config.Model.Num_threads
|
||||
cfg.model.num_threads = config.Model.NumThreads
|
||||
cfg.model.debug = config.Model.Debug
|
||||
cfg.model.provider = C.CString(config.Model.Provider)
|
||||
defer C.free(unsafe.Pointer(cfg.model.provider))
|
||||
|
||||
Reference in New Issue
Block a user