Struct hyphenation::Standard[][src]

pub struct Standard {
    pub exceptions: Exceptions,
    pub minima: (usize, usize),
    // some fields omitted
}
Expand description

A dictionary for standard Knuth–Liang hyphenation.

It comprises the working language, the pattern and exception sets, and the character boundaries for hyphenation.

Fields

exceptions: Exceptionsminima: (usize, usize)

The minimum number of chars from the start and end of a word where breaks may not occur.

Implementations

impl Standard[src]

pub fn language(&self) -> Language[src]

The language for which this dictionary can provide hyphenation.

pub fn prefix_tallies(
    &'f self,
    query: &'q [u8]
) -> PrefixTallies<'f, 'q, Vec<Locus, Global>>
[src]

An iterator over the tallies associated to all prefixes of the query, including the query itself.

Trait Implementations

impl Clone for Standard[src]

pub fn clone(&self) -> Standard[src]

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Debug for Standard[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl<'de> Deserialize<'de> for Standard[src]

pub fn deserialize<__D>(
    __deserializer: __D
) -> Result<Standard, <__D as Deserializer<'de>>::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl From<Builder> for Standard[src]

pub fn from(b: Builder) -> Standard[src]

Performs the conversion.

impl<'h> Hyphenator<'h> for Standard[src]

type Opportunity = usize

Plain representation of a word break.

type Exact = usize

An owned opportunity used to specify and store the predetermined hyphenation of known words. Read more

fn hyphenate<'t>(&'h self, word: &'t str) -> Word<'t, Self::Opportunity>[src]

Hyphenate a word, computing appropriate word breaks and preparing it for iteration. Read more

fn opportunities_within(
    &'h self,
    word: &str,
    (l, r): (usize, usize)
) -> Vec<usize>
[src]

The hyphenation opportunities that arise by pattern between the specified byte indices. Read more

fn exception_within(
    &'h self,
    w: &str,
    (l, r): (usize, usize)
) -> Option<Vec<Self::Opportunity>>
[src]

The hyphenation opportunities that arise by exception between the specified byte indices, if any. Read more

fn add_exception(&mut self, w: String, ops: Vec<usize>) -> Option<Vec<usize>>[src]

Specify the hyphenation of the given word with an exact sequence of opportunities and add it to the exception list. Subsequent calls to hyphenate or opportunities will yield this hyphenation instead of generating one from patterns. Read more

fn remove_exception(&mut self, w: &str) -> Option<Vec<usize>>[src]

If the word is an exception, remove it and return the previously specified opportunities; otherwise, return none. Read more

fn unbreakable_chars(&self) -> (usize, usize)[src]

The number of chars from the start and end of a word where breaks may not occur, according to dictionary parameters. Read more

fn opportunities(&'h self, lowercase_word: &str) -> Vec<Self::Opportunity>[src]

The hyphenation opportunities that our dictionary can find in the given word. The word should be lowercase. Read more

fn exception(&'h self, lowercase_word: &str) -> Option<Vec<Self::Opportunity>>[src]

If this word is a known exception, retrieve its specified hyphenation.

fn boundaries(&self, word: &str) -> Option<(usize, usize)>[src]

The byte indices delimiting the substring where breaks may occur, unless the word is too short to be hyphenated. Read more

impl Load for Standard[src]

fn from_reader<R>(lang: Language, reader: &mut R) -> Result<Self> where
    R: Read
[src]

Deserialize a dictionary from the provided reader, verifying that it belongs to the expected language. Read more

fn any_from_reader<R>(reader: &mut R) -> Result<Self> where
    R: Read
[src]

Deserialize a dictionary from the provided reader.

fn from_path<P>(lang: Language, path: P) -> Result<Self> where
    P: AsRef<Path>, 
[src]

Read and deserialize the dictionary at the given path, verifying that it belongs to the expected language. Read more

impl<'d> Score<'d> for Standard[src]

type Value = u8

A value assigned to each index — which is to say, to each potential break between letters — to determine whether the string can be broken at that index. Read more

fn denotes_opportunity(v: Self::Value) -> bool[src]

Whether the given value denotes a valid break.

fn score(&'d self, word: &str) -> Vec<u8>[src]

Generate a word’s hyphenation score, from which opportunities may be extracted. Read more

impl Serialize for Standard[src]

pub fn serialize<__S>(
    &self,
    __serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]