This library module provides phonetic string similarity functions, comparing strings with basis on how they sound.
These metrics are particularly effective in matching names, since names are often spelled in different ways that sound the same.
The logic contained in this module is not specific to any particular XQuery implementation.
metaphone-key
($s1 as xs:string) as xs:string
Returns the Metaphone key for a given string. |
metaphone
($s1 as xs:string, $s2 as xs:string) as xs:boolean
Checks if two strings have the same Metaphone key. |
soundex-key
($s1 as xs:string) as xs:string
Returns the Soundex key for a given string. |
soundex
($s1 as xs:string, $s2 as xs:string) as xs:boolean
Checks if two strings have the same Soundex key. |
declare function simp:metaphone-key($s1 as xs:string) as xs:string
Returns the Metaphone key for a given string.
The Metaphone algorithm produces variable length keys as its output, as opposed to Soundex's fixed-length keys.
Example usage :
metaphone-key("ALEKSANDER")
The function invocation in the example above returns :
"ALKSNTR"
declare function simp:metaphone($s1 as xs:string, $s2 as xs:string) as xs:boolean
Checks if two strings have the same Metaphone key.
Example usage :
metaphone("ALEKSANDER", "ALEXANDRE")
The function invocation in the example above returns :
true
declare function simp:soundex-key($s1 as xs:string) as xs:string
Returns the Soundex key for a given string.
Example usage :
soundex-key("Robert")
The function invocation in the example above returns :
"R163"
declare function simp:soundex($s1 as xs:string, $s2 as xs:string) as xs:boolean
Checks if two strings have the same Soundex key.
Example usage :
soundex( "Robert" , "Rupert" )
The function invocation in the example above returns :
true