Recognizer class

Class representing the recognizer created by the plugin.

Constructors

Recognizer({required int id, required Model model, required int sampleRate, required MethodChannel channel, Pointer<VoskRecognizer>? recognizerPointer, VoskLibrary? voskLibrary})
Use VoskFlutterPlugin.createRecognizer to create a Recognizer instance.

Properties

hashCode int
The hash code for this object.
no setterinherited
id int
Unique id of the recognizer.
final
model Model
Vosk model containing static data for the recognizer. Model can be shared across recognizers.
final
recognizerPointer Pointer<VoskRecognizer>?
Pointer to a native recognizer object.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sampleRate int
The sample rate of the audio you are going to feed into the recognizer.
final

Methods

acceptWaveformBytes(Uint8List bytes) Future<bool>
Accept and process new chunk of voice data(audio data in PCM 16-bit mono format).
acceptWaveformFloats(Float32List floats) Future<bool>
Accept and process new chunk of voice data(audio data in PCM 16-bit mono format).
dispose() Future<void>
Releases recognizer object. Underlying model is also unreferenced and if needed, released.
getFinalResult() Future<String>
Returns speech recognition result. Same as result, but doesn't wait for silence. You usually call it in the end of the stream to get final bits of audio. It flushes the feature pipeline, so all remaining audio chunks got processed.
getPartialResult() Future<String>
Returns partial speech recognition. If alternatives enabled it returns result with alternatives, see setMaxAlternatives. If word times enabled returns word time, see also setWords.
getResult() Future<String>
Returns speech recognition result. If alternatives enabled it returns result with alternatives, see setMaxAlternatives. If word times enabled returns word time, see also setWords.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() Future<void>
Resets current results so the recognition can continue from scratch.
setGrammar(List<String> grammar) Future<void>
Reconfigures recognizer to use grammar.
setMaxAlternatives(int maxAlternatives) Future<void>
Configures recognizer to output n-best results.
setPartialWords({required bool partialWords}) Future<void>
Same as setWords but for getPartialResult.
setWords({required bool words}) Future<void>
Enables/disables words with times in the output of the getResult.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited