sentencize 0.1.0

Rule-based sentence boundary detection: split text into sentences with abbreviation, decimal, ellipsis and quote handling. Zero dependencies.
Documentation
//! Demonstrates the two ways to segment text: borrowed slices and byte spans.
//!
//! Run with: `cargo run --example basic`

use sentencize::Segmenter;

fn main() {
    let text = "Dr. Smith arrived at 3.5 p.m. sharp. He said \"Sit down.\" \
                Then we began... or tried to. Really?!";

    println!("-- split() with the default rules --");
    for (i, sentence) in sentencize::split(text).iter().enumerate() {
        println!("{}. {sentence}", i + 1);
    }

    println!("\n-- spans() map back into the source text --");
    let seg = Segmenter::default();
    for (start, end) in seg.spans(text) {
        println!("[{start:>3}..{end:>3}] {}", &text[start..end]);
    }

    println!("\n-- a custom abbreviation prevents a false boundary --");
    let mut custom = Segmenter::default();
    custom.add_abbreviation("blvd");
    let address = "Turn at Sunset Blvd. Then stop.";
    println!("default: {:?}", sentencize::split(address));
    println!("custom:  {:?}", custom.sentences(address).collect::<Vec<_>>());
}