Encode a string to a list of int ids. Unknown chars → 0.
List<int> encode(String s) { final out = List<int>.filled(s.length, 0); for (int i = 0; i < s.length; i++) { out[i] = _stoi[s[i]] ?? 0; } return out; }