Struct mako::vocab::Vocab[][src]

pub struct Vocab {
    pub num_tokens: u32,
    pub token2index: HashMap<String, u32>,
    pub index2token: Vec<String>,
    pub PAD_token: u32,
    pub SOS_token: u32,
    pub EOS_token: u32,
    pub SEP_token: u32,
}
Expand description

Railgun Vocab Object

Fields

num_tokens: u32token2index: HashMap<String, u32>index2token: Vec<String>PAD_token: u32SOS_token: u32EOS_token: u32SEP_token: u32

Implementations

Make a new vocab

Add token to vocab

Add a vec of tokens to vocab

Remove a vec of tokens from vocab

Remove token from vocab

Get vec of tokens from vec of indexes

Batched version of tokens_from_indexes

Get vec of indexes from vec of tokens

Batched version of indexes_from_tokens

Trait Implementations

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.