Skip to main content

RepresentationBackend

Trait RepresentationBackend 

Source
pub trait RepresentationBackend: Send + Sync {
    // Required methods
    fn mapping_id(&self) -> &str;
    fn mapping_version(&self) -> &str;
    fn dimension(&self) -> usize;
    fn map(
        &self,
        vocabulary: &Vocabulary,
        token_id: u32,
    ) -> Result<Representation, KuteError>;
}
Expand description

Maps token ids to another representation. Mappings are versioned on their own and never change what a token id means (FR-015, ADR-0011).

Required Methods§

Source

fn mapping_id(&self) -> &str

Source

fn mapping_version(&self) -> &str

Source

fn dimension(&self) -> usize

Source

fn map( &self, vocabulary: &Vocabulary, token_id: u32, ) -> Result<Representation, KuteError>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§