pub trait SegmentationRules {
// Required methods
fn segment<'a>(&self, section: &'a str) -> Vec<&'a str>;
fn count_words(&self, segment: &str) -> usize;
fn count_characters(&self, segment: &str) -> usize;
}
Expand description
Trait to define custom segmentation rules.
Required Methods§
Sourcefn segment<'a>(&self, section: &'a str) -> Vec<&'a str>
fn segment<'a>(&self, section: &'a str) -> Vec<&'a str>
Given a section of text, most likely containing multiple sentences, segment the text into translatable units.
Sourcefn count_words(&self, segment: &str) -> usize
fn count_words(&self, segment: &str) -> usize
The amount of words in a particular segment
Sourcefn count_characters(&self, segment: &str) -> usize
fn count_characters(&self, segment: &str) -> usize
The amount of non-whitespace characters in a particular segment
Implementors§
impl SegmentationRules for UnicodeRules
The Segmentation rules implementation for UnicodeRules