Skip to content

TypeScript API

bsevern edited this page Apr 14, 2026 · 1 revision

TypeScript / Node.js API

GoldenMatch is also published as an npm package with full feature parity.

npm

npm install goldenmatch

Quick Start

import { dedupe } from "goldenmatch";

const rows = [
  { id: 1, name: "John Smith", email: "john@example.com", zip: "12345" },
  { id: 2, name: "Jon Smith",  email: "john@example.com", zip: "12345" },
  { id: 3, name: "Jane Doe",   email: "jane@example.com", zip: "54321" },
];

const result = dedupe(rows, {
  fuzzy: { name: 0.85 },
  blocking: ["zip"],
  threshold: 0.85,
});

console.log(result.stats);

Three entrypoints

// Edge-safe core — browsers, Workers, Edge Runtime, Deno
import { dedupe, match, scoreStrings } from "goldenmatch";

// Node-only — file I/O, HTTP servers, DB connectors
import { readFile, writeCsv, startApiServer } from "goldenmatch/node";

// CLI
// npx goldenmatch-js dedupe data.csv --output golden.csv

Scorers

Scorer Use case Example
exact Exact equality "abc" === "abc" -> 1
jaro_winkler Short strings (names) MARTHA vs MARHTA -> 0.9611
levenshtein Normalized edit distance kitten vs sitting -> 0.5714
token_sort rapidfuzz Indel on sorted tokens New York Mets vs Mets New York -> 1.0
soundex_match Phonetic match Smith = Smyth (S530)
dice, jaccard PPRL bloom filters -
ensemble Max of JW + token_sort + soundex*0.8 -

Servers

npx goldenmatch-js mcp-serve           # MCP for Claude Desktop / Code
npx goldenmatch-js serve --port 8000   # REST API
npx goldenmatch-js agent-serve         # A2A agent
npx goldenmatch-js tui data.csv        # Interactive TUI

Optional peer deps

Zero-dep install works. Install what you need:

Peer dep Unlocks
yaml YAML config loading
hnswlib-node Sub-linear ANN blocking
@huggingface/transformers ONNX cross-encoder
piscina Worker-thread parallel scoring
ink + widgets Interactive TUI
pg Postgres + sync
@duckdb/node-api DuckDB
snowflake-sdk, @google-cloud/bigquery, @databricks/sql Cloud warehouses

Advanced features

  • Probabilistic matching - Fellegi-Sunter with Splink-style EM
  • PPRL - SHA-256 bloom filters, byte-for-byte Python interop, 3 security levels
  • Graph ER - Multi-table entity resolution with evidence propagation
  • Streaming - Incremental single-record matching
  • Memory - Persistent corrections + threshold learning
  • Sensitivity - Parameter sweep with CCMS/TWI

Python vs TypeScript

Feature Python TypeScript
Core matching Polars + rapidfuzz Pure TS
Fellegi-Sunter Yes Yes
PPRL SHA-256 SHA-256 (byte-parity)
LLM OpenAI/Anthropic Same (via fetch, edge-safe)
Cross-encoder sentence-transformers @huggingface/transformers
ANN blocking FAISS hnswlib-node
Parallel Threads + Ray piscina
TUI Textual Ink
Edge-safe core No Yes

Examples

11 runnable examples: https://github.com/benzsevern/goldenmatch/tree/main/packages/goldenmatch-js/examples

Source

GoldenMatch

PyPI npm

🟡 Golden Suite (Monorepo)

Suite Packages

Getting Started

Core Concepts

AI Integration

Advanced

Reference


pip install goldenmatch
npm install goldenmatch

Clone this wiki locally