[][src]Struct syntaxdot_tokenizers::BertTokenizer

pub struct BertTokenizer { /* fields omitted */ }

BERT word piece tokenizer.

This tokenizer splits CoNLL-X tokens into word pieces. For example, a sentence such as:

Veruntreute die AWO Spendengeld ?

Could be split (depending on the vocabulary) into the following word pieces:

Ver ##unt ##reute die A ##W ##O Spenden ##geld [UNK]

Then vocabulary index of each such piece is returned.

The unknown token (here [UNK]) can be specified while constructing a tokenizer.

Implementations

impl BertTokenizer[src]

pub fn new(word_pieces: WordPieces, unknown_piece: impl Into<String>) -> Self[src]

Construct a tokenizer from wordpieces and the unknown piece.

pub fn open<P>(
    model_path: P,
    unknown_piece: impl Into<String>
) -> Result<Self, TokenizerError> where
    P: AsRef<Path>, 
[src]

pub fn read<R>(
    buf_read: R,
    unknown_piece: impl Into<String>
) -> Result<BertTokenizer, TokenizerError> where
    R: BufRead
[src]

Trait Implementations

impl Tokenize for BertTokenizer[src]

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.