mod abbrev;
mod chars;
mod sentences;
mod tokens;
pub use sentences::split_sentences;
pub use tokens::tokenize;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct Substring<'a> {
pub start: usize,
pub stop: usize,
pub text: &'a str,
}
fn push_substring<'a>(
out: &mut Vec<Substring<'a>>,
text: &'a str,
start: usize,
stop: usize,
trim: bool,
) {
let mut start = start;
let mut view = &text[start..stop];
if trim {
let (offset, trimmed) = sentences::trim_view(view);
start += offset;
view = trimmed;
}
if !view.is_empty() {
out.push(Substring { start, stop: start + view.len(), text: view });
}
}