Phonetic Spelling Algorithms in R
phonics provides phonetic encoders for English, German, and French
names, plus the two-stage Match Rating Approach comparison. Every encoder
accepts character vectors and preserves their length and order.
Installation
Install the released package from CRAN:
install.packages("phonics")Load it and encode one or more names:
library(phonics)
soundex(c("Robert", "Rupert"))
caverphone(c("Peter", "Peady"), modified = TRUE)
phonics(c("Catherine", "Kathryn"), c("soundex", "nysiis", "metaphone"))By default, an input containing characters outside an encoder's supported
alphabet produces a warning and an NA result. Set clean = FALSE to discard
unsupported characters before encoding. maxCodeLen is a validated
nonnegative whole-number bound where supported; Cologne uses unbounded output
when maxCodeLen = NULL.
Algorithms included
| Algorithm | Function and variants |
|---|---|
| Caverphone | caverphone() (Caverphone 1 and Caverphone 2) |
| Cologne Phonetic | cologne() |
| Lein | lein() |
| Match Rating Approach | mra_encode() and mra_compare() |
| Metaphone | metaphone() |
| NYSIIS | nysiis() (original and USDA modified) |
| Oxford Name Compression Algorithm | onca() |
| Phonex | phonex() |
| Roger Root | rogerroot() |
| Soundex | soundex() and refinedSoundex() |
| Census Modified Statistics Canada | statcan() |
ONCA's source describes an unpublished “anglicised” NYSIIS first stage.
onca() therefore uses the documented standard NYSIIS rules; its modified
NYSIIS and Refined Soundex combinations are explicit package extensions.
Runtime dependencies
The package imports Rcpp and data.table. Test, vignette, and documentation
tools are development dependencies declared in DESCRIPTION.
Contribution guidelines
For more information
- Package reference
- Howard, J. P., II (2020). “Phonetic Spelling Algorithm Implementations for R.” Journal of Statistical Software, 95(8), 1–21. doi:10.18637/jss.v095.i08
Acknowledgements
This work used the Extreme Science and Engineering Discovery Environment (XSEDE), which is supported by National Science Foundation grant number ACI-1548562. In particular, it used the Comet system at the San Diego Supercomputing Center (SDSC) through allocations TG-DBS170012 and TG-ASC150024.