Trait tokenizers::tokenizer::Decoder

source ·
pub trait Decoder {
    // Required method
    fn decode_chain(&self, tokens: Vec<String>) -> Result<Vec<String>>;

    // Provided method
    fn decode(&self, tokens: Vec<String>) -> Result<String> { ... }
}
Expand description

A Decoder changes the raw tokens into its more readable form.

Required Methods§

source

fn decode_chain(&self, tokens: Vec<String>) -> Result<Vec<String>>

Provided Methods§

source

fn decode(&self, tokens: Vec<String>) -> Result<String>

Implementors§

source§

impl Decoder for DecoderWrapper

source§

impl Decoder for BPEDecoder

source§

impl Decoder for ByteFallback

source§

impl Decoder for CTC

source§

impl Decoder for Fuse

source§

impl Decoder for Sequence

source§

impl Decoder for Strip

source§

impl Decoder for WordPiece

source§

impl Decoder for Replace

source§

impl Decoder for ByteLevel

As a Decoder, ByteLevel is in charge of converting any byte-level characters to their unicode counterpart, before merging everything back into a single String. This decoder will consume the tokens and merge them in one step to alleviate the fact that single token decoded might be a byte not representable as as String.

source§

impl Decoder for Metaspace