Skip to main content

Crate simi

Crate simi 

Source
Expand description

§SIMI – Similarity Toolkit

A general-purpose toolkit of similarity checks, designed to protect developers from wasting compute and money on LLMs for simple tasks.

§Feature flags

  • std (default on) – enables standard library integration.
  • python – enables Python bindings via PyO3.
  • nodejs – enables Node.js bindings via napi-rs.

§Quick start

use simi::algo::{levenshtein, jaro_winkler};

let d = levenshtein::similarity("kitten", "sitting");
assert!((d - 0.571).abs() < 0.01);

let j = jaro_winkler::similarity("MARTHA", "MARHTA");
assert!((j - 0.961).abs() < 0.01);

Re-exports§

pub use batch::BatchComparator;
pub use error::SimiError;
pub use preprocess::Preprocessor;
pub use router::resolve_intent;
pub use router::Intent;
pub use router::SimiFlow;
pub use router::Strategy;
pub use router::Threshold;
pub use algo::*;

Modules§

algo
The Algorithm Arsenal
batch
Batch processing: uses rayon to evaluate arrays of thousands of strings in parallel across all CPU cores.
error
prelude
Common imports for the simi crate.
preprocess
String preprocessors: zero-copy string cleanup that normalizes unicode, handles whitespace, and removes stop-words before the math happens.
router
The SimiFlow Routing Pipeline