Getting started

August 2, 2026 · View on GitHub

Glyph Ribbon

Getting started

Fingerprint text. Compare similarity in one call.

Glyph builds MinHash signatures from text. You use Create() to fingerprint, then Compare() to score overlap.

Install

npm install @koda.oss/glyph

Node.js 18 or newer is required.

First compare

import { Create, Compare } from "@koda.oss/glyph";

const a = Create("the quick brown fox jumps over the lazy dog");
const b = Create("the quick brown fox leaped over the lazy dog");

const { similarity, distance, matches, size } = Compare(a, b);
FieldRange / typeMeaning
similarity01Estimated Jaccard similarity
matchesintegerMatching signature slots
distanceintegersize - matches
sizeintegerSignature length

Mental model

  1. Tokenize input text into words.
  2. Build a feature bag: tokens, unigrams, vgrams.
  3. Run bag MinHash to produce a Uint32Array (glyph).
  4. Compare glyphs by counting equal slots.

Identical normalized text gives similarity: 1. Unrelated text is near 0.

What Create returns

{
  "version": 1,
  "glyph": "<Uint32Array>",
  "createdAt": 1710000000000
}
  • version — create pipeline version.
  • glyph — the fingerprint bytes.
  • createdAt — milliseconds since epoch (changes each call).

You can pass a full record or record.glyph into Compare and Serialize.

Related links ranked by Glyph.