Skip to content

thatbraxguy/findMostSimilar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

find Most Similar

Use Levenshtein distance alg to find the most similar word in an array. Perfect for providing suggestions in error messages and/or recovering from spelling mistakes.

Install

Install via npm

 npm install --save find-most-similar

How to use

import findMostSimilar from 'find-most-similar';

// the word you are checking others against
const source = 'book';

// words to search for the closest to the source word
const words = ['lock','block', 'back', 'hack'];

// returns the word that requires the fewest changes to convert to the source word
findMostSimilar(source, words);

// returns 'back'

License

MIT

About

Use Levenshtein distance alg to find the most similar word in an array to the target word

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors