[][src]Struct arpabet_types::Arpabet

pub struct Arpabet { /* fields omitted */ }

A dictionary that contains mappings of words to polyphones.

Implementations

impl Arpabet[src]

pub fn new() -> Arpabet[src]

Create an empty Arpabet.

pub fn from_map(map: HashMap<Word, Polyphone>) -> Self[src]

Create an Arpabet from a map. Consumes the map.

pub fn from_phf_map(map: &Map<&str, &[Phoneme]>) -> Self[src]

Create an Arpabet from a phf::Map. Used internally for allocation from codegen. Unfortunately this needs to allocate a new HashMap and copy data over.

pub fn get_polyphone(&self, word: &str) -> Option<Polyphone>[src]

Get a polyphone from the dictionary.

pub fn get_polyphone_ref(&self, word: &str) -> Option<&Polyphone>[src]

Get a polyphone from the dictionary.

pub fn get_polyphone_str(&self, word: &str) -> Option<Vec<&'static str>>[src]

Get a polyphone from the dictionary.

pub fn combine(&self, other: &Arpabet) -> Arpabet[src]

Combine two Arpabets and return the result. Items in the second Arpabet take precedence.

pub fn merge_from(&mut self, other: &Arpabet)[src]

Merge the supplied Arpabet into the current one. Items in the supplied Arpabet override existing entries should they already exist.

pub fn insert(&mut self, key: Word, value: Vec<Phoneme>) -> Option<Vec<Phoneme>>[src]

Insert an entry into the Arpabet. If the entry is already present, replace it and return the old value.

pub fn remove(&mut self, key: &str) -> Option<Vec<Phoneme>>[src]

Remove an entry from the arpabet. If it is present, it will be returned.

pub fn keys(&self) -> Keys<'_, String, Vec<Phoneme>>[src]

Return a keys iterator that walks the keys in random order.

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

Reports the number of entries in the arpabet.

Trait Implementations

impl Clone for Arpabet[src]

impl Default for Arpabet[src]

Auto Trait Implementations

impl RefUnwindSafe for Arpabet

impl Send for Arpabet

impl Sync for Arpabet

impl Unpin for Arpabet

impl UnwindSafe for Arpabet

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> 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, 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.