(&self, tokens: Vec<u32>)
| 20 | |
| 21 | #[napi] |
| 22 | pub fn decode(&self, tokens: Vec<u32>) -> Result<String, Error> { |
| 23 | match self |
| 24 | .encoding |
| 25 | .decode(tokens.iter().map(|x| *x as usize).collect()) |
| 26 | { |
| 27 | Ok(text) => Ok(text), |
| 28 | Err(err) => Err(Error::from_reason(err.to_string())), |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | #[napi] |
| 33 | pub fn encode_batch(&self, texts: Vec<String>) -> Vec<Vec<u32>> { |