Trait hyphenation::hyphenator::Hyphenator [−][src]
pub trait Hyphenator<'h> { type Opportunity; type Exact; fn hyphenate<'t>(&'h self, word: &'t str) -> Word<'t, Self::Opportunity>; fn opportunities_within(
&'h self,
lowercase_word: &str,
bounds: (usize, usize)
) -> Vec<Self::Opportunity>; fn exception_within(
&'h self,
lowercase_word: &str,
bounds: (usize, usize)
) -> Option<Vec<Self::Opportunity>>; fn add_exception(
&mut self,
lowercase_word: String,
ops: Vec<Self::Exact>
) -> Option<Vec<Self::Exact>>; fn remove_exception(&mut self, word: &str) -> Option<Vec<Self::Exact>>; fn unbreakable_chars(&self) -> (usize, usize); fn opportunities(&'h self, lowercase_word: &str) -> Vec<Self::Opportunity> { ... } fn exception(
&'h self,
lowercase_word: &str
) -> Option<Vec<Self::Opportunity>> { ... } fn boundaries(&self, word: &str) -> Option<(usize, usize)> { ... } }
Expand description
A dictionary capable of hyphenating individual words.
For the purpose of hyphenation, a “word” should not be a compound in hyphenated form (such as “hard-nosed”), but a single run of letters without intervening punctuation or spaces.
For details, refer to the patterns/*.chr.txt
file for each language.
Associated Types
type Opportunity
[src]
type Opportunity
[src]Plain representation of a word break.
Required methods
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>
[src]Hyphenate a word, computing appropriate word breaks and preparing it for iteration.
Soft hyphens take priority over dictionary hyphenation; if the word contains any, they will be returned as the only breaks available.
This method is case-insensitive.
fn opportunities_within(
&'h self,
lowercase_word: &str,
bounds: (usize, usize)
) -> Vec<Self::Opportunity>
[src]
fn opportunities_within(
&'h self,
lowercase_word: &str,
bounds: (usize, usize)
) -> Vec<Self::Opportunity>
[src]The hyphenation opportunities that arise by pattern between the specified byte indices.
fn exception_within(
&'h self,
lowercase_word: &str,
bounds: (usize, usize)
) -> Option<Vec<Self::Opportunity>>
[src]
fn exception_within(
&'h self,
lowercase_word: &str,
bounds: (usize, usize)
) -> Option<Vec<Self::Opportunity>>
[src]The hyphenation opportunities that arise by exception between the specified byte indices, if any.
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.
If the word is already a known exception, the old opportunities are returned.
If the word is an exception, remove it and return the previously specified opportunities; otherwise, return none.
Provided methods
fn opportunities(&'h self, lowercase_word: &str) -> Vec<Self::Opportunity>
[src]
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.
If this word is a known exception, retrieve its specified hyphenation.
Implementors
fn opportunities_within(
&'h self,
word: &str,
(l, r): (usize, usize)
) -> Vec<Self::Opportunity>
[src]fn exception_within(
&'h self,
w: &str,
(l, r): (usize, usize)
) -> Option<Vec<Self::Opportunity>>
[src]type Opportunity = usize
fn exception_within(
&'h self,
w: &str,
(l, r): (usize, usize)
) -> Option<Vec<Self::Opportunity>>
[src]