[][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

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]

Auto Trait Implementations

Blanket Implementations

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

impl<T> From<T> for T[src]

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

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

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