Skip to content

Commit

Permalink
Fix sherpa_onnx.go (#1353)
Browse files Browse the repository at this point in the history
  • Loading branch information
lllwan committed Sep 17, 2024
1 parent 9dade25 commit bf06b26
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/go/sherpa_onnx.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,12 +610,15 @@ func (recognizer *OfflineRecognizer) DecodeStreams(s []*OfflineStream) {
func (s *OfflineStream) GetResult() *OfflineRecognizerResult {
p := C.SherpaOnnxGetOfflineStreamResult(s.impl)
defer C.SherpaOnnxDestroyOfflineRecognizerResult(p)
n := int(p.count)
if n == 0 {
return nil
}
result := &OfflineRecognizerResult{}
result.Text = C.GoString(p.text)
result.Lang = C.GoString(p.lang)
result.Emotion = C.GoString(p.emotion)
result.Event = C.GoString(p.event)
n := int(p.count)
result.Tokens = make([]string, n)
tokens := (*[1 << 28]*C.char)(unsafe.Pointer(p.tokens_arr))[:n:n]
for i := 0; i < n; i++ {
Expand Down

0 comments on commit bf06b26

Please sign in to comment.