Standard

Struct Standard 

Source
pub struct Standard {
    pub exceptions: Exceptions,
    pub minima: (usize, usize),
    /* private fields */
}
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: Exceptions§minima: (usize, usize)

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

Implementations§

Source§

impl Standard

Source

pub fn language(&self) -> Language

The language for which this dictionary can provide hyphenation.

Source

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

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

Trait Implementations§

Source§

impl Clone for Standard

Source§

fn clone(&self) -> Standard

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Standard

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Standard

Source§

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

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Builder> for Standard

Source§

fn from(b: Builder) -> Standard

Converts to this type from the input type.
Source§

impl<'h> Hyphenator<'h> for Standard

Source§

type Opportunity = usize

Plain representation of a word break.
Source§

type Exact = usize

An owned opportunity used to specify and store the predetermined hyphenation of known words.
Source§

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

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

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

The hyphenation opportunities that arise by pattern between the specified byte indices.
Source§

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

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

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

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
Source§

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

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

fn unbreakable_chars(&self) -> (usize, usize)

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

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

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

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

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

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

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

impl Load for Standard

Source§

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

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

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

Deserialize a dictionary from the provided reader.
Source§

fn from_embedded(lang: Language) -> Result<Self>

Deserialize the embedded dictionary for the given language.
Source§

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

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

impl<'d> Score<'d> for Standard

Source§

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.
Source§

fn denotes_opportunity(v: Self::Value) -> bool

Whether the given value denotes a valid break.
Source§

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

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

impl Serialize for Standard

Source§

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

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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