Skip to content

Instantly share code, notes, and snippets.

@daynebatten
Created May 25, 2016 19:56
Show Gist options
  • Save daynebatten/c331d5174ea62303d0891fcab587fe2b to your computer and use it in GitHub Desktop.
Save daynebatten/c331d5174ea62303d0891fcab587fe2b to your computer and use it in GitHub Desktop.
-- Only 1 operation necessary to convert
select
levenshtein('cat', 'bat'); --1
-- Similar and not-so-similar names
select
levenshtein('christina', 'kristina'), --2
levenshtein('josephus', 'kristina'); --8
-- Similar and not-so-similar pronunciations
select
levenshtein(metaphone('christina', 100), metaphone('kristina', 100)), --0
levenshtein(metaphone('josephus', 100), metaphone('kristina', 100)); --4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment