Struct hyphenation::extended::Extended [−][src]
pub struct Extended { pub language: Language, pub patterns: Patterns, pub exceptions: Exceptions, pub minima: (usize, usize), }
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
language: Language
patterns: Patterns
exceptions: Exceptions
minima: (usize, usize)
The minimum number of char
s from the start and end of a word where
breaks may not occur.
Trait Implementations
impl<'de> Deserialize<'de> for Extended
[src]
impl<'de> Deserialize<'de> for Extended
fn deserialize<__D>(
__deserializer: __D
) -> Result<Extended, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(
__deserializer: __D
) -> Result<Extended, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Serialize for Extended
[src]
impl Serialize for Extended
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
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
impl Clone for Extended
[src]
impl Clone for Extended
fn clone(&self) -> Extended
[src]
fn clone(&self) -> Extended
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Extended
[src]
impl Debug for Extended
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Eq for Extended
[src]
impl Eq for Extended
impl PartialEq<Extended> for Extended
[src]
impl PartialEq<Extended> for Extended
fn eq(&self, other: &Extended) -> bool
[src]
fn eq(&self, other: &Extended) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Extended) -> bool
[src]
fn ne(&self, other: &Extended) -> bool
This method tests for !=
.
impl<'h> Hyphenator<'h> for Extended
[src]
impl<'h> Hyphenator<'h> for Extended
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]
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
fn opportunities_within(
&'h self,
word: &str,
(l, r): (usize, usize)
) -> Vec<Self::Opportunity>
[src]
fn opportunities_within(
&'h self,
word: &str,
(l, r): (usize, usize)
) -> Vec<Self::Opportunity>
The hyphenation opportunities that arise between the specified indices. Read more
fn exact(&'h self, w: &str) -> Option<Vec<Self::Opportunity>>
[src]
fn exact(&'h self, w: &str) -> Option<Vec<Self::Opportunity>>
Retrieve the known exact hyphenation for this word, if any.
fn add_exact(
&mut self,
w: String,
ops: Vec<Self::Exact>
) -> Option<Vec<Self::Exact>>
[src]
fn add_exact(
&mut self,
w: String,
ops: Vec<Self::Exact>
) -> Option<Vec<Self::Exact>>
Specify the hyphenation of the given word with an exact sequence of opportunities. Subsequent calls to hyphenate
or opportunities
will yield this hyphenation instead of generating one from patterns. Read more
fn unbreakable_chars(&self) -> (usize, usize)
[src]
fn unbreakable_chars(&self) -> (usize, usize)
The number of char
s from the start and end of a word where breaks may not occur. Read more
fn opportunities(&'h self, lowercase_word: &str) -> Vec<Self::Opportunity>
[src]
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. Read more
fn boundaries(&self, word: &str) -> Option<(usize, usize)>
[src]
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. Read more
impl Load for Extended
[src]
impl Load for Extended
fn from_reader<R>(lang: Language, reader: &mut R) -> Result<Self> where
R: Read,
[src]
fn from_reader<R>(lang: Language, reader: &mut R) -> Result<Self> where
R: Read,
Deserialize a dictionary from the provided reader, verifying that it effectively belongs to the requested language. Read more
fn any_from_reader<R>(reader: &mut R) -> Result<Self> where
R: Read,
[src]
fn any_from_reader<R>(reader: &mut R) -> Result<Self> where
R: Read,
Deserialize a dictionary from the provided reader.
fn from_path<P>(lang: Language, path: P) -> Result<Self> where
P: AsRef<Path>,
[src]
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 effectively belongs to the requested language. Read more
impl<'d> Score<'d> for Extended
[src]
impl<'d> Score<'d> for Extended
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]
fn denotes_opportunity((v, _): Self::Value) -> bool
Whether the given value denotes a valid break.
fn score(&'d self, word: &str) -> Vec<Self::Value>
[src]
fn score(&'d self, word: &str) -> Vec<Self::Value>
Generate a word's hyphenation score, from which opportunities may be extracted. Read more