0.0.12 • Published 4 years ago

gestalt-pattern-matcher v0.0.12

Weekly downloads
48
License
MIT
Repository
github
Last release
4 years ago

gestalt-pattern-matcher GitHub license npm version downloads

This is an implementation of the Ratcliff/Obershelp Gestalt pattern-matching algorithm in NodeJS.

Its purpose is to compare two strings and determine approximately how different they are: a score of 0 indicates that they share no characters at all, while a score of 1 indicates that the two strings are identical.

This implementation is suitable for short strings (on the order of 1000 characters long). I haven't thoroughly analyzed complexity, but it is roughly O(n^2) average case, O(n^3) in the worst case, and O(n) in the best case.

Install

Just install it with npm or yarn.

npm install gestalt-pattern-matcher
# or
yarn add gestalt-pattern-matcher

Usage

// ES7
import gestaltSimilarity from "gestalt-pattern-matcher";

const firstString = "Test 1";
const secondString = "Test 2";

console.log(gestaltSimilarity(firstString, secondString));

// commonJS
const gestaltSimilarity = require("gestalt-pattern-matcher").default;

const firstString = "Test 1";
const secondString = "Test 2";

console.log(gestaltSimilarity(firstString, secondString));

Notice

This npm module is based on GitSage gestalt-pattern-matcher repository, whom we personally thank the author for the contributions.

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago