avila-tokenizers 0.1.0

The most complete tokenizer library in Rust - BPE, WordPiece, Unigram, with native support for GPT, BERT, Llama, Claude
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub mod byte_level;
pub mod wordpiece;
pub mod metaspace;
pub mod strip;

pub use byte_level::ByteLevelDecoder;
pub use wordpiece::WordPieceDecoder;
pub use metaspace::MetaspaceDecoder;
pub use strip::StripDecoder;

use crate::error::Result;

/// Trait for decoding tokens back to text
pub trait Decoder: Send + Sync {
    /// Decode tokens to text
    fn decode(&self, tokens: &[String]) -> Result<String>;
}