From a2684cd93a7eb4271f138fcc5b6d820e01a63b5a Mon Sep 17 00:00:00 2001 From: xdrudis Date: Tue, 25 Jul 2023 09:10:12 -0700 Subject: [PATCH] go : implement SetSplitOnWord (#1114) * Go binding: Implement SetSplitOnWord * Add comment for consistency --- bindings/go/params.go | 4 ++++ bindings/go/pkg/whisper/context.go | 4 ++++ bindings/go/pkg/whisper/interface.go | 1 + 3 files changed, 9 insertions(+) diff --git a/bindings/go/params.go b/bindings/go/params.go index 1ddcbeaa..b480ccf8 100644 --- a/bindings/go/params.go +++ b/bindings/go/params.go @@ -19,6 +19,10 @@ func (p *Params) SetTranslate(v bool) { p.translate = toBool(v) } +func (p *Params) SetSplitOnWord(v bool) { + p.split_on_word = toBool(v) +} + func (p *Params) SetNoContext(v bool) { p.no_context = toBool(v) } diff --git a/bindings/go/pkg/whisper/context.go b/bindings/go/pkg/whisper/context.go index 0db27705..6f3c2c74 100644 --- a/bindings/go/pkg/whisper/context.go +++ b/bindings/go/pkg/whisper/context.go @@ -81,6 +81,10 @@ func (context *context) SetSpeedup(v bool) { context.params.SetSpeedup(v) } +func (context *context) SetSplitOnWord(v bool) { + context.params.SetSplitOnWord(v) +} + // Set number of threads to use func (context *context) SetThreads(v uint) { context.params.SetThreads(int(v)) diff --git a/bindings/go/pkg/whisper/interface.go b/bindings/go/pkg/whisper/interface.go index dc9c66df..771961ab 100644 --- a/bindings/go/pkg/whisper/interface.go +++ b/bindings/go/pkg/whisper/interface.go @@ -42,6 +42,7 @@ type Context interface { SetDuration(time.Duration) // Set duration SetThreads(uint) // Set number of threads to use SetSpeedup(bool) // Set speedup flag + SetSplitOnWord(bool) // Set split on word flag SetTokenThreshold(float32) // Set timestamp token probability threshold SetTokenSumThreshold(float32) // Set timestamp token sum probability threshold SetMaxSegmentLength(uint) // Set max segment length in characters