Skip to main content

encode

Function encode 

Source
pub fn encode(text: &str, vocab: &[String]) -> Result<Vec<u64>>
Expand description

Encode a text against a vocabulary. Only single-character vocabularies are supported: sub-word tokens need longest-match encoding, which comes with presk data bpe.