SIMI -- Similarity Toolkit
A general-purpose toolkit of similarity checks, designed to protect developers from wasting compute and money on LLMs for simple tasks.
Quick Start
use ;
// Levenshtein similarity (typos and spelling)
let d = similarity;
println!; // ~0.571
// Jaro-Winkler similarity (names)
let j = similarity;
println!; // ~0.961
Features
8 Algorithms, Categorized by Data Type
| Category | Algorithms | Best For |
|---|---|---|
| Short Strings and Typos | Levenshtein, Jaro-Winkler, Hamming | Names, typos, equal-length codes |
| Sets and Documents | Jaccard, MinHash, SimHash | N-gram sets, large document fingerprints |
| Statistical Meaning | BM25, TF-IDF + Cosine | Search ranking, term-weighted vectors |
SimiFlow Pipeline
use ;
let result = new
.preprocess
.strategy
.tier_1
.tier_2
.fallback
.compare
.unwrap;
Tier 1 -- fast pass (Jaro-Winkler). Tier 2 -- heavy local pass (BM25).
Tier 3 -- optional LLM/API hook. No more writing manual fallback logic.
Batch Parallelism
use BatchComparator;
use Algo;
let comparator = new;
let results = comparator.compare_pairs?;
Powered by rayon -- evaluates thousands of pairs across all CPU cores.
String Preprocessing
use Preprocessor;
let cleaned = new
.with_lowercase
.with_remove_stopwords
.process;
// => "quick brown fox"
Installation
Rust (crates.io)
Python (PyPI)
Node.js (npm)
Architecture
simi
├── algo/ -- 8 similarity algorithms
├── preprocess -- Unicode normalization, whitespace, stopwords
├── router -- SimiFlow pipeline builder
├── batch -- rayon-based parallel evaluation
├── python -- PyO3 bindings
└── nodejs -- napi-rs bindings
License
MIT -- see LICENSE.