Learn R Programming

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

AlgorithmFunction and variants
Caverphonecaverphone() (Caverphone 1 and Caverphone 2)
Cologne Phoneticcologne()
Leinlein()
Match Rating Approachmra_encode() and mra_compare()
Metaphonemetaphone()
NYSIISnysiis() (original and USDA modified)
Oxford Name Compression Algorithmonca()
Phonexphonex()
Roger Rootrogerroot()
Soundexsoundex() and refinedSoundex()
Census Modified Statistics Canadastatcan()

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

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.

Copy Link

Version

Install

install.packages('phonics')

Monthly Downloads

703

Version

1.4.0

License

BSD_2_clause + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

James P. Howard

Last Published

August 23rd, 2026

Functions in phonics (1.4.0)

mra_encode

Match Rating Approach Encoder
onca

Oxford Name Compression Algorithm
caverphone

Caverphone
cologne

Cologne Phonetic Name Coding
metaphone

Generate phonetic versions of strings with Metaphone
phonics

Phonetic Spelling Algorithms
phonics-package

Phonetic spelling algorithms
nysiis

New York State Identification and Intelligence System
lein

Lein Name Coding
phonex

Phonex Name Coding
rogerroot

Roger Root Name Coding Procedure
statcan

Statistics Canada Name Coding
soundex

Soundex