Trait SegmentationRules

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

Source

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.

Source

fn count_words(&self, segment: &str) -> usize

The amount of words in a particular segment

Source

fn count_characters(&self, segment: &str) -> usize

The amount of non-whitespace characters in a particular segment

Implementors§

Source§

impl SegmentationRules for UnicodeRules

The Segmentation rules implementation for UnicodeRules