[][src]Enum rust_bert::pipelines::common::TokenizerOption

pub enum TokenizerOption {
    Bert(BertTokenizer),
    Roberta(RobertaTokenizer),
    XLMRoberta(XLMRobertaTokenizer),
    Marian(MarianTokenizer),
    T5(T5Tokenizer),
    Albert(AlbertTokenizer),
}

Variants

Bert Tokenizer

Roberta Tokenizer

Roberta Tokenizer

Marian Tokenizer

T5 Tokenizer

Albert Tokenizer

Implementations

impl TokenizerOption[src]

pub fn from_file(
    model_type: ModelType,
    vocab_path: &str,
    merges_path: Option<&str>,
    lower_case: bool
) -> Self
[src]

Interface method to load a tokenizer from file

pub fn model_type(&self) -> ModelType[src]

Returns the model type

pub fn encode_list(
    &self,
    text_list: Vec<&str>,
    max_len: usize,
    truncation_strategy: &TruncationStrategy,
    stride: usize
) -> Vec<TokenizedInput>
[src]

Interface method

pub fn tokenize(&self, text: &str) -> Vec<String>[src]

Interface method to tokenization

pub fn build_input_with_special_tokens(
    &self,
    tokens_1: Vec<i64>,
    tokens_2: Option<Vec<i64>>,
    offsets_1: Vec<Option<Offset>>,
    offsets_2: Option<Vec<Option<Offset>>>,
    original_offsets_1: Vec<Vec<OffsetSize>>,
    original_offsets_2: Option<Vec<Vec<OffsetSize>>>,
    mask_1: Vec<Mask>,
    mask_2: Option<Vec<Mask>>
) -> (Vec<i64>, Vec<i8>, Vec<i8>, Vec<Option<Offset>>, Vec<Vec<OffsetSize>>, Vec<Mask>)
[src]

Interface method to build input with special tokens

pub fn convert_tokens_to_ids(&self, tokens: &Vec<String>) -> Vec<i64>[src]

Interface method to convert tokens to ids

pub fn get_pad_id(&self) -> Option<i64>[src]

Interface method

pub fn get_sep_id(&self) -> Option<i64>[src]

Interface method

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,