The function metaphone phonetically encodes the
given string using the metaphone algorithm.
Details
Metaphone has accumulated incompatible implementation variants. This function follows the traditional rules from Philips' 1990 algorithm; it is therefore not expected to reproduce PHP or Apache Commons Codec for every input.
The variable maxCodeLen is the limit on how long the returned
metaphone should be.
The metaphone algorithm is only defined for inputs over the
standard English alphabet, i.e., "A-Z.". Non-alphabetical
characters are removed from the string in a locale-dependent fashion.
This strips spaces, hyphens, and numbers. Other letters, such as
"Ü," may be permissible in the current locale but are unknown to
metaphone. For inputs outside of its known range, the output
is undefined and NA is returned and a warning this
thrown. If clean is FALSE, metaphone attempts
to process the strings. The default is TRUE.
References
James P. Howard, II, "Phonetic Spelling Algorithm Implementations for R," Journal of Statistical Software, vol. 95, no. 8, (2020), p. 1–21, <10.18637/jss.v095.i08>.
Lawrence Philips, "Hanging on the Metaphone," Computer Language, vol. 7, no. 12 (1990), p. 38–44.
See also
Other phonics:
caverphone(),
cologne(),
lein(),
mra_encode(),
nysiis(),
onca(),
phonex(),
phonics(),
rogerroot(),
soundex(),
statcan()
Examples
metaphone("wheel")
#> [1] "WL"
metaphone(c("school", "benji"))
#> [1] "SXL" "BNJ"