[][src]Struct finalfrontier::SubwordVocab

pub struct SubwordVocab { /* fields omitted */ }

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 is_empty(&self) -> bool[src]

fn len(&self) -> usize[src]

Get the number of entries in the vocabulary.

impl From<SubwordVocab> for VocabWrap[src]

impl<T> From<VocabBuilder<SubwordVocabConfig, T>> for SubwordVocab where
    T: Hash + Eq + Into<String>, 
[src]

Constructs a SubwordVocab from a VocabBuilder<T> where T: Into<String>.

impl Clone for SubwordVocab[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.