Skip to content

Instantly share code, notes, and snippets.

@camelcaseblog
Last active February 27, 2019 06:50
Show Gist options
  • Save camelcaseblog/06e952c433ab98696061002495f68fdc to your computer and use it in GitHub Desktop.
Save camelcaseblog/06e952c433ab98696061002495f68fdc to your computer and use it in GitHub Desktop.
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