[−][src]Struct tokenizers::models::bpe::BPE
A Byte Pair Encoding model.
Methods
impl BPE
[src]
pub fn builder() -> BpeBuilder
[src]
Initialize a BpeBuilder
.
pub fn new(
vocab: HashMap<String, u32>,
merges: HashMap<(u32, u32), (u32, u32)>
) -> Self
[src]
vocab: HashMap<String, u32>,
merges: HashMap<(u32, u32), (u32, u32)>
) -> Self
Create a new BPE model with the given vocab and merges.
pub fn from_files(vocab: &str, merges: &str) -> BpeBuilder
[src]
Initialize a BpeBuilder model from vocab and merges files
pub fn read_files(
vocab: &str,
merges: &str
) -> Result<(HashMap<String, u32>, HashMap<(u32, u32), (u32, u32)>)>
[src]
vocab: &str,
merges: &str
) -> Result<(HashMap<String, u32>, HashMap<(u32, u32), (u32, u32)>)>
Read the given files to extract the vocab and merges
pub fn clear_cache(&self)
[src]
Reset the cache.
pub fn get_vocab(&self) -> &HashMap<String, u32>
[src]
pub fn get_unk_token(&self) -> &Option<String>
[src]
pub fn get_continuing_subword_prefix(&self) -> &Option<String>
[src]
Trait Implementations
impl Clone for BPE
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for BPE
[src]
impl Model for BPE
[src]
fn get_vocab(&self) -> &HashMap<String, u32>
[src]
fn get_vocab_size(&self) -> usize
[src]
fn tokenize(&self, sentence: Vec<(String, Offsets)>) -> Result<Vec<Token>>
[src]
fn token_to_id(&self, token: &str) -> Option<u32>
[src]
fn id_to_token(&self, id: u32) -> Option<String>
[src]
fn save(&self, folder: &Path, name: Option<&str>) -> Result<Vec<PathBuf>>
[src]
Auto Trait Implementations
impl RefUnwindSafe for BPE
impl Send for BPE
impl Sync for BPE
impl Unpin for BPE
impl UnwindSafe for BPE
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,