decodeWhisperText function
Decodes Whisper text tokens to a string. Special tokens are skipped.
Implementation
String decodeWhisperText(Iterable<int> tokens) {
final bytes = <int>[];
for (final token in tokens) {
if (token < 0 || token >= whisperTextPieces.length) continue;
for (final unit in whisperTextPieces[token].codeUnits) {
bytes.add(_byteForUnit[unit]);
}
}
return utf8.decode(bytes, allowMalformed: true).trim();
}