Skip to content

Instantly share code, notes, and snippets.

@camelcaseblog
Last active February 27, 2019 06:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
const levenshtein = require("js-levenshtein")
const normalizedLevenshtein = (a, b) => levenshtein(a, b) / Math.max(a.length, b.length)
console.log(normalizedLevenshtein("headphones", "headph0nes"))
// 0.1
console.log(normalizedLevenshtein("לימון", "לימונים"))
// 0.42857142857142855
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment