(&self, tokens: &[u32])
| 195 | } |
| 196 | |
| 197 | pub fn decode(&self, tokens: &[u32]) -> String { |
| 198 | let text: String = tokens.iter().map(|t| self.decoder[t].as_str()).collect(); |
| 199 | let decoded_bytes: Vec<u8> = text.chars().map(|c| self.byte_decoder[&c]).collect(); |
| 200 | |
| 201 | String::from_utf8_lossy(&decoded_bytes[..]).replace("</w>", " ") |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | #[cfg(test)] |
no outgoing calls