Skip to main content

Encoder

Trait Encoder 

Source
pub trait Encoder: Send + Sync {
    // Required methods
    fn encode(&self, input: &str, add_special_tokens: bool) -> Result<Encoding>;
    fn encode_batch(
        &self,
        inputs: &[&str],
        add_special_tokens: bool,
    ) -> Result<Vec<Encoding>>;
}
Expand description

Core encoding trait - separate from decoding for modularity

Required Methods§

Source

fn encode(&self, input: &str, add_special_tokens: bool) -> Result<Encoding>

Source

fn encode_batch( &self, inputs: &[&str], add_special_tokens: bool, ) -> Result<Vec<Encoding>>

Implementors§