Last active
May 25, 2016 19:28
-
-
Save daynebatten/63f91004eebda35ef2ed42368fcf317a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- With metaphone, a hard C and hard K both code to 'K' | |
-- Note that you specify a maximum encoding length, since metaphone can return long encodings | |
select | |
metaphone('kristina', 100), -- KRSTN | |
metaphone('christina', 100); --KRSTN | |
-- Metaphone thinks the GH is pronounced like 'laugh' | |
-- But double metaphone knows the GH is silent | |
select | |
metaphone('hayleigh', 100), --HLF | |
dmetaphone('hayleigh'); --HL | |
-- Metaphone encodings can get long | |
select | |
metaphone('antidisestablishmentarianism', 100); --ANTTSSTBLXMNTRNSM | |
-- Double metaphone makes sure Smith and Schmidt share at least 1 encoding | |
select | |
dmetaphone('smith'), --SM0 | |
dmetaphone_alt('smith'), --XMT | |
dmetaphone('schmidt'), --XMT | |
dmetaphone_alt('schmidt'); --SMT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment