decode method
Decodes a list of token IDs back to vocabulary strings.
Unknown IDs are mapped to '[UNK]'. Primarily for diagnostics.
Implementation
List<String> decode(List<int> ids) {
final inverse = <int, String>{};
_vocab.forEach((k, v) => inverse[v] = k);
return ids.map((id) => inverse[id] ?? '[UNK]').toList();
}