Struct hyphenation::extended::Extended[][src]

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

A dictionary for extended Knuth–Liang hyphenation, based on the strategy described by Németh in “Automatic non-standard hyphenation in OpenOffice.org”.

It comprises the working language, the set of extended patterns and exceptions, 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 Extended[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, Tally>[src]

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

Trait Implementations

impl Debug for Extended[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 Extended[src]

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

Deserialize this value from the given Serde deserializer. Read more

impl From<Builder> for Extended[src]

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

Performs the conversion.

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

type Opportunity = (usize, Option<&'h Subregion>)

Plain representation of a word break.

type Exact = (usize, Option<Subregion>)

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<Self::Opportunity>
[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<Self::Exact>
) -> Option<Vec<Self::Exact>>
[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<Self::Exact>>[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 Extended[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 Extended[src]

type Value = (u8, Option<&'d Subregion>)

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<Self::Value>[src]

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

impl Serialize for Extended[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, 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]