[−][src]Struct finalfrontier::SubwordVocab
A corpus vocabulary with subword lookup.
Methods
impl<C, I> SubwordVocab<C, I> where
C: Copy + Clone,
I: Indexer,
[src]
C: Copy + Clone,
I: Indexer,
pub fn new(
config: SubwordVocabConfig<C>,
words: Vec<Word>,
n_tokens: usize,
indexer: I
) -> Self
[src]
config: SubwordVocabConfig<C>,
words: Vec<Word>,
n_tokens: usize,
indexer: I
) -> Self
Construct a new vocabulary.
pub fn word(&self, word: &str) -> Option<&Word>
[src]
Get the given word.
Trait Implementations
impl<C, I> Vocab for SubwordVocab<C, I> where
C: Copy + Clone,
I: Indexer,
[src]
C: Copy + Clone,
I: Indexer,
type VocabType = String
type IdxType = WordWithSubwordsIdx
type Config = SubwordVocabConfig<C>
fn config(&self) -> SubwordVocabConfig<C>
[src]
fn idx<Q: ?Sized>(&self, key: &Q) -> Option<Self::IdxType> where
Self::VocabType: Borrow<Q>,
Q: Hash + Eq,
[src]
Self::VocabType: Borrow<Q>,
Q: Hash + Eq,
fn discard(&self, idx: usize) -> f32
[src]
fn n_input_types(&self) -> usize
[src]
fn types(&self) -> &[Word]
[src]
fn n_types(&self) -> usize
[src]
fn is_empty(&self) -> bool
[src]
fn len(&self) -> usize
[src]
impl<I, T> From<VocabBuilder<SubwordVocabConfig<BucketConfig>, T>> for SubwordVocab<BucketConfig, I> where
T: Hash + Eq + Into<String>,
I: BucketIndexer,
[src]
T: Hash + Eq + Into<String>,
I: BucketIndexer,
Constructs a SubwordVocab
from a VocabBuilder<T>
where T: Into<String>
.
fn from(builder: VocabBuilder<SubwordVocabConfig<BucketConfig>, T>) -> Self
[src]
impl<T> From<VocabBuilder<SubwordVocabConfig<NGramConfig>, T>> for SubwordVocab<NGramConfig, ExplicitIndexer> where
T: Hash + Eq + Into<String>,
[src]
T: Hash + Eq + Into<String>,
Constructs a SubwordVocab
from a VocabBuilder<T>
where T: Into<String>
.
fn from(builder: VocabBuilder<SubwordVocabConfig<NGramConfig>, T>) -> Self
[src]
impl From<SubwordVocab<BucketConfig, HashIndexer<FnvHasher>>> for VocabWrap
[src]
fn from(vocab: SubwordVocab<BucketConfig, FinalfusionHashIndexer>) -> Self
[src]
impl From<SubwordVocab<NGramConfig, ExplicitIndexer>> for VocabWrap
[src]
fn from(vocab: SubwordVocab<NGramConfig, ExplicitIndexer>) -> Self
[src]
impl<C: Clone, I: Clone> Clone for SubwordVocab<C, I>
[src]
fn clone(&self) -> SubwordVocab<C, I>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl<C, I> Send for SubwordVocab<C, I> where
C: Send,
I: Send,
C: Send,
I: Send,
impl<C, I> Sync for SubwordVocab<C, I> where
C: Sync,
I: Sync,
C: Sync,
I: Sync,
impl<C, I> Unpin for SubwordVocab<C, I> where
C: Unpin,
I: Unpin,
C: Unpin,
I: Unpin,
impl<C, I> UnwindSafe for SubwordVocab<C, I> where
C: UnwindSafe,
I: UnwindSafe,
C: UnwindSafe,
I: UnwindSafe,
impl<C, I> RefUnwindSafe for SubwordVocab<C, I> where
C: RefUnwindSafe,
I: RefUnwindSafe,
C: RefUnwindSafe,
I: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,