decodeNemoAsrText function
Joins SentencePiece tokens: ▁ starts a word. Special tokens, such as
<unk> and <|nospeech|>, are skipped.
Implementation
String decodeNemoAsrText(List<String> vocabulary, List<int> tokens) {
final out = StringBuffer();
for (final id in tokens) {
final token = vocabulary[id];
if (token.startsWith('<') && token.endsWith('>')) continue;
out.write(token.replaceAll('▁', ' '));
}
return out.toString().trim();
}