Skip to content

go: Add SetNlsml to VoskRecognizer - #2064

Open
fra-shipper wants to merge 1 commit into
alphacep:masterfrom
fra-shipper:fix/go-set-nlsml
Open

go: Add SetNlsml to VoskRecognizer#2064
fra-shipper wants to merge 1 commit into
alphacep:masterfrom
fra-shipper:fix/go-set-nlsml

Conversation

@fra-shipper

Copy link
Copy Markdown

The C API exposes vosk_recognizer_set_nlsml() (declared in src/vosk_api.h, implemented in src/recognizer.cc) and the Python, Java, C#, and Node bindings all wrap it, but the Go binding does not. Go users cannot switch a recognizer to NLSML output without dropping to cgo themselves.

This adds (*VoskRecognizer).SetNlsml, following the exact shape of the neighbouring SetPartialWords / SetWords wrappers in the same file.

Testing: go build . on the go/ package is clean and gofmt -l vosk.go reports nothing introduced by this diff. The example binaries under go/example cannot be linked here because that requires the prebuilt libvosk shared library, which is distributed as a binary release rather than built from this tree, so no runtime test was run against a real model.

vosk_recognizer_set_nlsml toggles NLSML output (the W3C markup used by
VoiceXML/IVR platforms) but was only wrapped for VoskBatchRecognizer
(go/batch.go). The standard VoskRecognizer in go/vosk.go had no
binding for it, unlike the Python and Ruby bindings which both expose
it on their standard recognizer.

Add SetNlsml on VoskRecognizer mirroring the existing SetWords /
SetPartialWords wrappers and the SetNlsml already present on
VoskBatchRecognizer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant