Search Shortcut cmd + k | ctrl + k
duckdb_rphonetic

Phonetic algorithms for German and European name matching

Maintainer(s): guizmaii

Installing and Loading

INSTALL duckdb_rphonetic FROM community;
LOAD duckdb_rphonetic;

Example

-- Kölner Phonetik: a German-language counterpart to Soundex.
-- Spelling variants of the same name encode identically.
SELECT cologne_phonetic('Müller'), cologne_phonetic('Mueller');
-- 657, 657

-- Daitch-Mokotoff Soundex returns SEVERAL codes for ambiguous spellings,
-- so a match is a set overlap rather than an equality test.
SELECT daitch_mokotoff('Klein'), daitch_mokotoff('Cleyn');
-- [586000], [586000, 486000]

SELECT list_has_any(daitch_mokotoff('Klein'), daitch_mokotoff('Cleyn'));
-- true

About duckdb_rphonetic

Two phonetic encoders aimed at European name matching, wrapping the rphonetic crate by Dalvany — a Rust port of Apache Commons Codec.

  • cologne_phonetic(VARCHAR) -> VARCHAR — Kölner Phonetik (Postel, 1969), the German-language counterpart to Soundex. Handles umlauts and ß, so Müller and Mueller share a code.
  • daitch_mokotoff(VARCHAR) -> VARCHAR[] — Daitch-Mokotoff Soundex, built for Germanic and Slavic surnames. Returns a list because ambiguous spellings legitimately encode several ways; match with list_has_any.

Neither exists in core DuckDB, whose soundex and double_metaphone are tuned for English. Trigram similarity is not a substitute: Klein and Cleyn share no trigrams at all, yet both encoders match them.

Behavioural note. Kölner Phonetik implementations disagree on whether a dropped 0 breaks a run of identical digits. This extension follows rphonetic, which yields cologne_phonetic('Dieter') = '227'; Apache Commons Codec yields 27. The two differ on 36 of a 279-name test corpus. Every divergence is committed to the repository and pinned by a test, so the output cannot change silently. The published reference vectors (Müller-Lüdenscheidt -> 65752682, Wikipedia -> 3412, Breschnew -> 17863) are unaffected. Daitch-Mokotoff agrees with Commons Codec on all 279 names.

Added Functions

function_name function_type description comment examples
cologne_phonetic scalar NULL NULL  
daitch_mokotoff scalar NULL NULL  

Overloaded Functions

This extension does not add any function overloads.

Added Types

This extension does not add any types.

Added Settings

This extension does not add any settings.