vosk

package module
v0.3.50 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 2 Imported by: 8

README

See example subfolder for instructions how to use the module

Documentation

Overview

Go bindings for Vosk speech recognition toolkit. Vosk is an offline open source speech to text API for Android, iOS, Raspberry Pi and servers. It enables speech recognition models for 18 languages and dialects - English, Indian English, German, French, Spanish, Portuguese, Chinese, Russian, Turkish, Vietnamese, Italian, Dutch, Catalan, Arabic, Greek, Farsi, Filipino, Ukrainian.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GPUInit added in v0.3.36

func GPUInit()

GPUInit automatically selects a CUDA device and allows multithreading.

func GPUThreadInit added in v0.3.36

func GPUThreadInit()

GPUThreadInit inits CUDA device in a multi-threaded environment.

func SetLogLevel added in v0.3.36

func SetLogLevel(logLevel int)

SetLogLevel sets the log level for Kaldi messages.

Types

type VoskModel

type VoskModel struct {
	// contains filtered or unexported fields
}

VoskModel contains a reference to the C VoskModel

func NewModel

func NewModel(modelPath string) (*VoskModel, error)

NewModel creates a new VoskModel instance

func (*VoskModel) FindWord added in v0.3.36

func (m *VoskModel) FindWord(word string) int

FindWord checks if a word can be recognized by the model. Returns the word symbol if the word exists inside the model or -1 otherwise.

func (*VoskModel) Free added in v0.3.42

func (m *VoskModel) Free()

type VoskRecognizer

type VoskRecognizer struct {
	// contains filtered or unexported fields
}

VoskRecognizer contains a reference to the C VoskRecognizer

func NewRecognizer

func NewRecognizer(model *VoskModel, sampleRate float64) (*VoskRecognizer, error)

NewRecognizer creates a new VoskRecognizer instance

func NewRecognizerGrm added in v0.3.36

func NewRecognizerGrm(model *VoskModel, sampleRate float64, grammar string) (*VoskRecognizer, error)

NewRecognizerGrm creates a new VoskRecognizer instance with the phrase list.

func NewRecognizerSpk added in v0.3.36

func NewRecognizerSpk(model *VoskModel, sampleRate float64, spkModel *VoskSpkModel) (*VoskRecognizer, error)

NewRecognizerSpk creates a new VoskRecognizer instance with a speaker model.

func (*VoskRecognizer) AcceptWaveform added in v0.3.36

func (r *VoskRecognizer) AcceptWaveform(buffer []byte) int

AcceptWaveform accepts and processes a new chunk of the voice data.

func (*VoskRecognizer) FinalResult added in v0.3.36

func (r *VoskRecognizer) FinalResult() string

FinalResult returns a speech recognition result. Same as result, but doesn't wait for silence.

func (*VoskRecognizer) Free added in v0.3.42

func (r *VoskRecognizer) Free()

func (*VoskRecognizer) PartialResult added in v0.3.36

func (r *VoskRecognizer) PartialResult() string

PartialResult returns a partial speech recognition result.

func (*VoskRecognizer) Reset added in v0.3.36

func (r *VoskRecognizer) Reset()

Reset resets the recognizer.

func (*VoskRecognizer) Result added in v0.3.36

func (r *VoskRecognizer) Result() string

Result returns a speech recognition result.

func (*VoskRecognizer) SetGrm added in v0.3.46

func (r *VoskRecognizer) SetGrm(grammar string)

SetGrm sets which phrases to recognize on an already initialized recognizer.

func (*VoskRecognizer) SetMaxAlternatives added in v0.3.36

func (r *VoskRecognizer) SetMaxAlternatives(maxAlternatives int)

SetMaxAlternatives configures the recognizer to output n-best results.

func (*VoskRecognizer) SetPartialWords added in v0.3.43

func (r *VoskRecognizer) SetPartialWords(words int)

SetPartialWords enables words with times in the partial ouput.

func (*VoskRecognizer) SetSpkModel added in v0.3.36

func (r *VoskRecognizer) SetSpkModel(spkModel *VoskSpkModel)

SetSpkModel adds a speaker model to an already initialized recognizer.

func (*VoskRecognizer) SetWords added in v0.3.36

func (r *VoskRecognizer) SetWords(words int)

SetWords enables words with times in the ouput.

type VoskSpkModel

type VoskSpkModel struct {
	// contains filtered or unexported fields
}

VoskSpkModel contains a reference to the C VoskSpkModel

func NewSpkModel

func NewSpkModel(spkModelPath string) (*VoskSpkModel, error)

NewSpkModel creates a new VoskSpkModel instance

func (*VoskSpkModel) Free added in v0.3.42

func (s *VoskSpkModel) Free()

Directories

Path Synopsis
Example package for Vosk Go bindings.
Example package for Vosk Go bindings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL