gestalt-pattern-matcher
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# oryarn add gestalt-pattern-matcher
Usage
// ES7;;;console.loggestaltSimilarityfirstString, secondString;// commonJS;;;console.loggestaltSimilarityfirstString, secondString;
Notice
This npm module is based on GitSage gestalt-pattern-matcher repository, whom we personally thank the author for the contributions.