[−][src]Struct finalfrontier::SubwordVocab
A corpus vocabulary with subword lookup.
Methods
impl SubwordVocab
[src]
pub fn word(&self, word: &str) -> Option<&Word>
[src]
Get the given word.
pub fn subword_indices(&self, word: &str) -> Cow<[u64]>
[src]
Get the subword indices of a word.
pub fn indices(&self, word: &str) -> Vec<u64>
[src]
Get all indices of a word, both regular and subword.
This method copies the subword list for known words into a new Vec.
Trait Implementations
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]
fn is_empty(&self) -> bool
[src]
fn len(&self) -> usize
[src]
Get the number of entries in the vocabulary.
impl Clone for SubwordVocab
[src]
fn clone(&self) -> SubwordVocab
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl From<SubwordVocab> for VocabWrap
[src]
fn from(vocab: SubwordVocab) -> VocabWrap
[src]
impl<T> From<VocabBuilder<SubwordVocabConfig, T>> for SubwordVocab 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, T>) -> Self
[src]
Auto Trait Implementations
impl Send for SubwordVocab
impl Sync for SubwordVocab
Blanket Implementations
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> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,