Measure the difference between two strings with the fastest JS implementation of the Levenshtein distance algorithm
by sindresorhusJavaScript
Last 12 weeks · 0 commits
4 of 6 standards met
This is the most performant Levenshtein implementation for NodeJS of which I know, and I have a though on how to make it faster for many applications. When testing many string pairs by similarity (for example, when sorting, or filtering strings above or below a threshold), often we are happy to short-circuit on any pair with a distance greater than . At scale, given that the least similar strings are also very expensive to compute, there is a big potential savings. (For one, just comparing length is enough to discard many candidates.) (For pairs with a distance above , the distance returned can be , or - I don't have a strong opinion on which is best, but probably is the most useful, as it would require not extra handling for sorting or filtering.)
Repository: sindresorhus/leven. Description: Measure the difference between two strings with the fastest JS implementation of the Levenshtein distance algorithm Stars: 734, Forks: 31. Primary language: JavaScript. Languages: JavaScript (100%). License: MIT. Latest release: v4.1.0 (9mo ago). Open PRs: 0, open issues: 0. Last activity: 9mo ago. Community health: 85%. Top contributors: sindresorhus, Yomguithereal, BendingBender, bnjmnt4n, gustf, kevva, Richienb, fisker.