Crate sakurs_core

Crate sakurs_core 

Source
Expand description

Delta-Stack Monoid algorithm for parallel sentence boundary detection

This crate implements a mathematically sound parallel approach to sentence boundary detection using monoid algebra. The core innovation lies in representing parsing state as a monoid, enabling associative operations that can be computed in parallel while maintaining perfect accuracy.

§Stability Notice

This crate is in pre-release (v0.1.0-dev). The API is not yet stable and may change significantly in future releases. Use with caution in production code.

We recommend pinning to exact versions in your Cargo.toml:

sakurs-core = "=0.1.0"

§Architecture

The crate follows a hexagonal architecture pattern:

  • Domain layer: Pure mathematical algorithms and monoid operations
  • Application layer: Orchestration and parallel processing logic
  • Adapter layer: Interfaces for different use cases (CLI, Python, etc.)

§Example

use sakurs_core::{SentenceProcessor, Input};

// Create processor with default configuration
let processor = SentenceProcessor::new();

// Process text
let text = "Hello world. This is a test.";
let result = processor.process(Input::from_text(text)).unwrap();

// Check boundaries
assert!(!result.boundaries.is_empty());
// Note: SentenceProcessor may detect different boundary counts than expected

Re-exports§

pub use api::Boundary;
pub use api::Config;
pub use api::ConfigBuilder;
pub use api::Error as ApiError;
pub use api::Input;
pub use api::Language;
pub use api::Output;
pub use api::ProcessingMetadata;
pub use api::ProcessingStats;
pub use api::SentenceProcessor;
pub use application::DeltaStackProcessor;
pub use application::DeltaStackResult;
pub use application::ExecutionMode;
pub use application::ProcessorConfig;
pub use domain::*;

Modules§

api
New unified API for sakurs-core
application
Application layer for orchestrating text processing
domain
Domain layer for the Delta-Stack Monoid algorithm