Phonetic Functions¶
Phonetic encoding functions for sound-based string matching.
Summary¶
| Function | Signature | Description |
|---|---|---|
caverphone |
string -> string |
Caverphone code |
caverphone2 |
string -> string |
Caverphone 2 code |
double_metaphone |
string -> object |
Double Metaphone codes |
match_rating_codex |
string -> string |
Match Rating codex |
metaphone |
string -> string |
Metaphone phonetic code |
nysiis |
string -> string |
NYSIIS phonetic code |
phonetic_match |
string, string, string -> boolean |
Check phonetic match with algorithm |
soundex |
string -> string |
Soundex phonetic code |
sounds_like |
string, string -> boolean |
Check if strings sound similar |
Functions¶
caverphone¶
Caverphone code
Signature: string -> string
Examples:
# Common name
caverphone('Smith') -> \"SMT1111111\"
# Another name
caverphone('Thompson') -> \"TMPSN11111\"
CLI Usage:
caverphone2¶
Caverphone 2 code
Signature: string -> string
Examples:
# Common name
caverphone2('Smith') -> \"SMT1111111\"
# Another name
caverphone2('Thompson') -> \"TMPSN11111\"
CLI Usage:
double_metaphone¶
Double Metaphone codes
Signature: string -> object
Examples:
# Common name
double_metaphone('Smith') -> {primary: 'SM0', secondary: 'XMT'}
# German variant
double_metaphone('Schmidt') -> {primary: 'XMT', secondary: 'SMT'}
CLI Usage:
match_rating_codex¶
Match Rating codex
Signature: string -> string
Examples:
# Common name
match_rating_codex('Smith') -> \"SMTH\"
# Another name
match_rating_codex('Johnson') -> \"JHNSN\"
CLI Usage:
metaphone¶
Metaphone phonetic code
Signature: string -> string
Examples:
CLI Usage:
nysiis¶
NYSIIS phonetic code
Signature: string -> string
Examples:
CLI Usage:
phonetic_match¶
Check phonetic match with algorithm
Signature: string, string, string -> boolean
Examples:
# Soundex match
phonetic_match('Smith', 'Smyth', 'soundex') -> true
# Metaphone match
phonetic_match('Robert', 'Rupert', 'metaphone') -> true
# No match
phonetic_match('John', 'Jane', 'soundex') -> false
CLI Usage:
soundex¶
Soundex phonetic code
Signature: string -> string
Examples:
# Common name
soundex('Robert') -> \"R163\"
# Same code as Robert
soundex('Rupert') -> \"R163\"
# Another name
soundex('Smith') -> \"S530\"
CLI Usage:
sounds_like¶
Check if strings sound similar
Signature: string, string -> boolean
Examples:
# Similar sounding
sounds_like('Robert', 'Rupert') -> true
# Spelling variants
sounds_like('Smith', 'Smyth') -> true
# Different names
sounds_like('John', 'Mary') -> false
CLI Usage: