npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@siktec-lab/simi-flow

v0.1.3

Published

SIMI — a similarity and text-analysis engine: 8 native algorithms for matching, dedup, spam, and bot protection

Readme

SIMI — a Similarity & Text-Analysis Engine for Node.js

npm CI License: MIT

Node.js bindings for SIMI, a production-grade similarity and text-analysis toolkit powered by napi-rs — a pure-Rust core exposed as a zero-dependency native addon. It gives your Node app 8 battle-tested algorithms behind one clean API, each returning a normalized [0.0, 1.0] score and running in nanoseconds to microseconds.

Use it across real workloads: bot/abuse protection, spam & content moderation, record matching, deduplication, search ranking, and fuzzy input handling — clustering near-duplicate submissions, reconciling records, or pre-filtering candidates with fast, deterministic checks.

const simi = require('@siktec-lab/simi-flow');

// Native, sub-microsecond, no network round-trip.
simi.jaro_winkler_similarity('MARTHA', 'MARHTA');  // 0.961
  • Native speed — Rust core, minimal FFI overhead. See Performance.
  • 8 algorithms, one API — edit distance, name matching, set overlap, document fingerprinting, probabilistic retrieval.
  • Prebuilt binaries — ships native addons for Linux, macOS (Intel + Apple Silicon), and Windows. No compiler needed.

Looking for intent-based routing (SimiFlow)? The routing pipeline currently ships in the Rust crate and Python package. The Node.js binding exposes the full set of algorithm and preprocessing functions documented below.

Installation

npm install @siktec-lab/simi-flow

Requires Node.js 18 or later.

Algorithms

All similarity functions return a normalized score in [0.0, 1.0] where 1.0 = identical.

Levenshtein (edit distance)

const simi = require('@siktec-lab/simi-flow');

// Raw distance
simi.levenshtein_distance('kitten', 'sitting');  // 3

// Normalized similarity
simi.levenshtein_similarity('kitten', 'sitting');  // 0.571

Jaro-Winkler (names and short strings)

simi.jaro_winkler_similarity('MARTHA', 'MARHTA');  // 0.961
simi.jaro_winkler_similarity('DWAYNE', 'DUANE');   // 0.840

Hamming (equal-length codes)

Throws an error if the strings have different lengths.

simi.hamming_distance('karolin', 'kathrin');        // 3
simi.hamming_similarity('karolin', 'kathrin');      // 0.571
simi.hamming_similarity('hello', 'hello');          // 1.0

// Different-length strings throw
simi.hamming_similarity('abc', 'abcd');  // throws: "Strings must have equal length"

Jaccard (n-grams and word sets)

// Configurable n-gram size
simi.jaccard_similarity('hello', 'hallo', 2);

// Convenience functions
simi.jaccard_bigram_similarity('hello', 'hallo');
simi.jaccard_trigram_similarity('hello', 'hallo');
simi.jaccard_word_similarity('the quick brown fox', 'the quick lazy dog');

MinHash (document fingerprinting)

// Get a 128-hash signature
const sig = simi.minhash_signature('large document text...', 3, 128);
// sig is an array of 128 numbers

// Compare with custom parameters
simi.minhash_similarity(a, b, 3, 128);

// Compare with defaults (shingle=3, hashes=128)
simi.minhash_similarity_default(a, b);

SimHash (64-bit LSH fingerprints)

// Get a 64-bit fingerprint as a number
const fp = simi.simhash_fingerprint('document text', 4);
const fp = simi.simhash_fingerprint_default('document text');  // shingle_size=4

// Compare
simi.simhash_similarity(a, b, 4);
simi.simhash_similarity_default(a, b);

BM25 (probabilistic retrieval)

simi.bm25_similarity('the quick brown fox', 'the quick blue fox');  // 0.5..0.8
simi.bm25_similarity('the quick brown fox', 'the quick brown fox');  // 1.0

TF-IDF + Cosine (term-weighted vectors)

simi.tfidf_similarity('the quick brown fox', 'the quick blue fox');  // 0.5..0.7
simi.tfidf_similarity('abc', 'xyz');                                  // 0.0

Preprocessing

Normalize text before comparison:

// Quick one-liners
simi.clean_text('  Hello   World!  ');               // 'hello world!'
simi.clean_text_stopwords('the quick brown fox');     // 'quick brown fox'

clean_text applies: Unicode NFC normalization, lowercase, whitespace collapse, and trimming. clean_text_stopwords does the same plus removes 180+ common English stopwords.

Performance

SIMI is built in Rust with napi-rs, so calls run at native speed:

| Algorithm | Input | Time | |---|---|---| | Levenshtein | "kitten"/"sitting" | ~80 ns | | Jaro-Winkler | "MARTHA"/"MARHTA" | ~200 ns | | Hamming | 7-char equal | ~150 ns | | Jaccard bigram | Short texts | ~1.7 us | | MinHash (128) | Short doc | ~17 us | | SimHash | Short doc | ~5 us | | BM25 | Short docs | ~2.9 us | | TF-IDF | Short texts | ~2.7 us |

These timings are from the Rust core. The npm binding adds minimal FFI overhead per call.

Reference

All exported functions

| Function | Parameters | Returns | |---|---|---| | levenshtein_distance | a, b | number | | levenshtein_similarity | a, b | number | | jaro_winkler_similarity | a, b | number | | hamming_distance | a, b | number | | hamming_similarity | a, b | number | | jaccard_similarity | a, b, n | number | | jaccard_bigram_similarity | a, b | number | | jaccard_trigram_similarity | a, b | number | | jaccard_word_similarity | a, b | number | | minhash_signature | text, shingle_size, num_hashes | number[] | | minhash_similarity | a, b, shingle_size, num_hashes | number | | minhash_similarity_default | a, b | number | | simhash_fingerprint | text, shingle_size | number | | simhash_fingerprint_default | text | number | | simhash_similarity | a, b, shingle_size | number | | simhash_similarity_default | a, b | number | | bm25_similarity | a, b | number | | tfidf_similarity | a, b | number | | clean_text | text | string | | clean_text_stopwords | text | string |

License

MIT -- see the LICENSE file.