Number of input and output field
| Number of input field |
: |
Two |
| Number of output field |
: |
One |
A measure of similarity between two strings. It returns a value in the interval [0.0, 1.0], where 0.0 indicates that the two strings are completely different and 1.0 indicates that they are identical.
This transformation function uses the Metaphone algorithm to measure the similarity between two strings. Metaphone is a phonetic algorithm that transforms words based on English pronunciation rules, producing a phonetic representation that can be compared for similarity.
The resulting Metaphone code consists of characters from the set {0, B, F, H, J, K, L, M, N, P, R, S, T, W, X, Y}. At the beginning of a word, vowels from the set {A, E, I, O, U} may also appear.
This approach is particularly useful for comparing words that sound similar but may be spelled differently.
Metaphone code computation algorithm
- Remove all repeating neighboring letters except letter C.
- The beginning of the word should be transformed using the following rules:
KN → N
GN → N
PN → N
AE → E
WR → R
- Remove B letter at the end, if it is after M letter.
- Replace C using the rules below:
With X: CIA → XIA, SCH → SKH, CH → XH
With S: CI → SI, CE → SE, CY → SY
With K: C → K
- Replace D using the following rules:
With J: DGE → JGE, DGY → JGY, DGI → JGY
With T: D → T
- Replace GH → H, except it is at the end or before a vowel.
- Replace GN → N and GNED → NED, if they are at the end.
- Replace G using the following rules
With J: GI → JI, GE → JE, GY → JY
With K: G → K
- Remove all H after a vowel but not before a vowel.
- Perform following transformations using the rules below:
CK → K
PH → F
Q → K
V → F
Z → S
- Replace S with X:
SH → XH
SIO → XIO
SIA → XIA
- Replace T using the following rules
With X: TIA → XIA, TIO → XIO
With 0: TH → 0
Remove: TCH → CH
- Transform WH → W at the beginning. Remove W if there is no vowel after it.
- If X is at the beginning, then replace X → S, else replace X → KS
- Remove all Y which are not before a vowel.
- Remove all vowels except vowel at the start of the word.