Trait finalfusion::vocab::Vocab

source ·
pub trait Vocab {
    // Required methods
    fn idx(&self, word: &str) -> Option<WordIndex>;
    fn words_len(&self) -> usize;
    fn vocab_len(&self) -> usize;
    fn words(&self) -> &[String];
}
Expand description

Embedding vocabularies.

Required Methods§

source

fn idx(&self, word: &str) -> Option<WordIndex>

Get the index of a token.

source

fn words_len(&self) -> usize

Get the number of words in the vocabulary.

source

fn vocab_len(&self) -> usize

Get the total length of this vocabulary, including possible subword indices.

source

fn words(&self) -> &[String]

Get the words in the vocabulary.

Implementors§