Nordic Panda Moor

    gestalt-pattern-matcher
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.12 • Public • Published

    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.

    Install

    npm i gestalt-pattern-matcher

    DownloadsWeekly Downloads

    49

    Version

    0.0.12

    License

    MIT

    Unpacked Size

    6.79 kB

    Total Files

    8

    Last publish

    Collaborators

    • saniales