Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

fuzz-search-js

AlfredDaimari24MIT1.0.4

library for fuzzy search

fuzzy, search, levenshtein, damerau-levenshtein, hamming distance, longest subsequence, edit distance, string matching, fuzzy matching

readme

fuzz-search-js

A library for implementing fuzzy search using:

  • levenshtein distance algorithm
  • damerau levenshtein distance algorith
  • hamming distance algorithm
  • longest subsequence algorithm

Installation

Using npm:

npm i --save fuzz-search-js

Options

  • level: the length of the string is the starting level, how many levels should it match strings above and below its level

  • max: how many strings should it return

const fuzzy = require("fuzz-search-js");
// For implementing Levenshtein Distance algorithm
const fuz = new fuzzy(["helo","hello", "boy of my own","an act","personal",])
console.log(fuz.lev('helo', options={level:1, max:2})) //default {level:3, max:5}
//expected value
[{ word: "helo", score: 0 },{ word: "hello", score: 1 },]

Algorithms in library for lists (how to call them)

//levenshtein distance
Object.lev("String");
//damerau levenshtein
Object.dam("String");

Algorithms in library for comparing two strings (will return score)

//levenshtein distance
fuzzy.getLevenDis("String1", "String2");
//hamming distance
fuzzy.getHamDis("String1", "String2");
//damerau levenshtein distance
fuzzy.getDamLevDis("String1", "String2");
//longest subsequence score
fuzzy.getLongSubqDis("String1", "String2");