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
impl Standard
Sourcepub fn language(&self) -> Language
pub fn language(&self) -> Language
The language for which this dictionary can provide hyphenation.
Sourcepub fn prefix_tallies<'f, 'q>(
&'f self,
query: &'q [u8],
) -> PrefixTallies<'f, 'q, Vec<Locus>>
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<'de> Deserialize<'de> for Standard
impl<'de> Deserialize<'de> for Standard
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Standard, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
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<'h> Hyphenator<'h> for Standard
impl<'h> Hyphenator<'h> for Standard
Source§type Opportunity = usize
type Opportunity = usize
Plain representation of a word break.
Source§type Exact = usize
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>
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>
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>>
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>>
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 moreSource§fn remove_exception(&mut self, w: &str) -> Option<Vec<usize>>
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)
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>
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§impl Load for Standard
impl Load for Standard
Source§fn from_reader<R>(lang: Language, reader: &mut R) -> Result<Self>where
R: Read,
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,
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>
fn from_embedded(lang: Language) -> Result<Self>
Deserialize the embedded dictionary for the given language.
Source§impl<'d> Score<'d> for Standard
impl<'d> Score<'d> for Standard
Source§impl Serialize for Standard
impl Serialize for Standard
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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§
impl Freeze for Standard
impl RefUnwindSafe for Standard
impl Send for Standard
impl Sync for Standard
impl Unpin for Standard
impl UnwindSafe for Standard
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more