pub struct SimpleVocab<T> { /* private fields */ }Expand description
Generic corpus vocabulary type.
Can be used as an input or output lookup.
Implementations§
Trait Implementations§
Source§impl<T: Clone> Clone for SimpleVocab<T>
impl<T: Clone> Clone for SimpleVocab<T>
Source§fn clone(&self) -> SimpleVocab<T>
fn clone(&self) -> SimpleVocab<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T, S> From<VocabBuilder<SimpleVocabConfig, T>> for SimpleVocab<S>
Constructs a SimpleVocab<S> from a VocabBuilder<T> where T: Into<S>.
impl<T, S> From<VocabBuilder<SimpleVocabConfig, T>> for SimpleVocab<S>
Constructs a SimpleVocab<S> from a VocabBuilder<T> where T: Into<S>.
Source§fn from(builder: VocabBuilder<SimpleVocabConfig, T>) -> Self
fn from(builder: VocabBuilder<SimpleVocabConfig, T>) -> Self
Converts to this type from the input type.
Source§impl<T> Vocab for SimpleVocab<T>
impl<T> Vocab for SimpleVocab<T>
type VocabType = T
type IdxType = SingleIdx
type Config = SimpleVocabConfig
Source§fn config(&self) -> SimpleVocabConfig
fn config(&self) -> SimpleVocabConfig
Return this vocabulary’s config.
Source§fn idx<Q>(&self, key: &Q) -> Option<Self::IdxType>
fn idx<Q>(&self, key: &Q) -> Option<Self::IdxType>
Get the index of the entry, will return None if the item is not present.
Source§fn discard(&self, idx: usize) -> f32
fn discard(&self, idx: usize) -> f32
Get the discard probability of the entry with the given index.
Source§fn n_input_types(&self) -> usize
fn n_input_types(&self) -> usize
Get the number of possible input types.
Source§fn types(&self) -> &[CountedType<Self::VocabType>]
fn types(&self) -> &[CountedType<Self::VocabType>]
Get all types in the vocabulary.
fn is_empty(&self) -> bool
Auto Trait Implementations§
impl<T> Freeze for SimpleVocab<T>
impl<T> RefUnwindSafe for SimpleVocab<T>where
T: RefUnwindSafe,
impl<T> Send for SimpleVocab<T>where
T: Send,
impl<T> Sync for SimpleVocab<T>where
T: Sync,
impl<T> Unpin for SimpleVocab<T>where
T: Unpin,
impl<T> UnwindSafe for SimpleVocab<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more