Compares two input strings using the Double Metaphone algorithm. An optional threshold parameter can be modified to adjust the tolerance for matching.

The Double Metaphone algorithm processes an input string render a primary and secondary spelling for it. For English language words, the algorithm removes silent letters, normalizes combinations of characters to a single definition, and removes vowels, except from the beginnings of words. In this manner, the algorithm can normalize inconsistencies between spellings for better matching. For more information, see https://en.wikipedia.org/wiki/Metaphone.

Tip: This function is useful for performing fuzzy matching between string values, such as between potential join key values.

Source values can be string literals, column references, or expressions that evaluate to strings.

String literal reference example:

derive type:single DOUBLEMETAPHONEEQUALS('My String', 'my string') as:'compare'

Output: Generates the value true in the compare column.

Column reference example:

derive type:single value:DOUBLEMETAPHONEEQUALS(string1, string2, 'weak') as:'compare_weak'

Output: Generates a new compare_weak column containing the comparison of string1 and string2 column values using the Double Metaphone algorithm. The 'weak' parameter input means that only the secondary encodings for each input must match.

derive type:single value:DOUBLEMETAPHONEQUALS(string_ref1, string_ref2, match_threshold)

ArgumentRequired?Data TypeDescription
string_ref1YstringName of first column or string literal to apply to the function
string_ref2YstringName of second column or string literal to apply to the function
match_thresholdNstringOptional string value for the matching threshold to use in the comparison. Default value is Normal.

string_ref1, string_ref2

String literal, column reference, or expression whose elements you want to filter through the Double Metaphone algorithm.

Required?Data TypeExample Value
YesString literal, column reference, or expression evaluating to a stringmyString1

match_threshold

String literal identifying the threshold that determines a match according to the Double Metaphone encodings of the input strings. Accepted values:

Threshold ValueDescription
'strong'The primary encodings of the two input strings must match.
'normal'(Default) The primary encoding of one input string must match either of the encodings of the other input string.
'weak'Either primary or secondary encoding of one input string must match either encoding of the other input string.

Required?Data TypeExample Value
YesString literal

'strong'


Example - Phonetic string comparisons