[−][src]Trait finalfrontier::Vocab
Trait for lookup of indices.
Associated Types
Loading content...Required methods
fn config(&self) -> Self::Config
Return this vocabulary's config.
fn idx<Q: ?Sized>(&self, key: &Q) -> Option<usize> where
Self::VocabType: Borrow<Q>,
Q: Hash + Eq,
Self::VocabType: Borrow<Q>,
Q: Hash + Eq,
Get the index of the entry, will return None if the item is not present.
fn discard(&self, idx: usize) -> f32
Get the discard probability of the entry with the given index.
fn types(&self) -> &[CountedType<Self::VocabType>]
Get all types in the vocabulary.
fn n_types(&self) -> usize
Get the number of types in the corpus.
This returns the number of types in the corpus that the vocabulary was constructed from, before removing types that are below the minimum count.
Provided methods
Loading content...Implementors
impl Vocab for SubwordVocab
[src]
type VocabType = String
type Config = SubwordVocabConfig
fn config(&self) -> SubwordVocabConfig
[src]
fn idx<Q: ?Sized>(&self, key: &Q) -> Option<usize> where
Self::VocabType: Borrow<Q>,
Q: Hash + Eq,
[src]
Self::VocabType: Borrow<Q>,
Q: Hash + Eq,
fn discard(&self, idx: usize) -> f32
[src]
fn types(&self) -> &[Word]
[src]
fn n_types(&self) -> usize
[src]
impl<T> Vocab for SimpleVocab<T> where
T: Hash + Eq,
[src]
T: Hash + Eq,
type VocabType = T
type Config = SimpleVocabConfig
fn config(&self) -> SimpleVocabConfig
[src]
fn idx<Q: ?Sized>(&self, key: &Q) -> Option<usize> where
Self::VocabType: Borrow<Q>,
Q: Hash + Eq,
[src]
Self::VocabType: Borrow<Q>,
Q: Hash + Eq,