Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a25b8799fea8fda9

Jump to content

// Workers AI · dad joke modeWhat did Cologne phonetics say? "You scent me?

From Wikipedia, the free encyclopedia
ClassPhonetic algorithm
Worst-case performanceO(N)
Best-case performanceO(N)
Average performanceO(N)
Worst-case space complexityO(N)

Cologne phonetics (also Kölner Phonetik, Cologne process) is a phonetic algorithm which assigns to words a sequence of digits, the phonetic code. The aim of this procedure is that identical sounding words have the same code assigned to them. The algorithm can be used to perform a similarity search between words. For example, it is possible in a name list to find entries like "Meier" under different spellings such as "Maier", "Mayer", or "Mayr". The Cologne phonetics is related to the well known Soundex phonetic algorithm but is optimized to match the German language. The algorithm was published in 1969 by Hans Joachim Postel.

Method

[edit]

The Cologne phonetics matches each letter of a word to a digit between "0" and "8". To select the appropriate digit, at most one adjacent letter is used as a context. Some rules apply specifically to the initials of words. In this way similar sounds are supposed to be assigned the same code. The letters "W" and "V" for example, are both encoded with the number "3". The phonetic code for "Wikipedia" is "3412" (W=3, K=4, P=1, and D=2). Unlike the Soundex code, the length of the codes from the Cologne phonetics method is not limited.

Procedure

[edit]
LetterContextCode
A, E, I, J, O, U, Y0
H-
B1
Pnot before H
D, Tnot before C, S, Z2
F, V, W3
Pbefore H
G, K, Q4
Cin the initial sound before A, H, K, L, O, Q, R, U, X
before A, H, K, O, Q, U, X except after S, Z
Xnot after C, K, Q48
L5
M, N6
R7
S, Z8
Cafter S, Z
in initial position except before A, H, K, L, O, Q, R, U, X
not before A, H, K, O, Q, U, X
D, Tbefore C, S, Z
Xafter C, K, Q

That for the letter "C" the rule "SC" has priority over the rule "CH" was taken into account by the addition of "except after S, Z" in line 10 of the table. This is not explicitly mentioned in the original publication but can be inferred from the examples listed there, e.g. for "Breschnew" the code "17863" is specified.

Lowercase letters are encoded accordingly; all other characters (such as hyphens) are ignored. For the umlauts Ä, Ö, Ü, as well as ß, that are not taken into account in the conversion table, it suggests itself to match them to the vowels (code "0") respective to the group S, Z (code "8").

Processing of a word is done in three steps:

  1. Encode letter by letter from left to right according to the conversion table.
  2. Remove all digits occurring more than once next to each other.
  3. Remove all code "0" except at the beginning.

Example

[edit]

The name Müller-Lüdenscheidt will be coded as follows:

  1. Encode each letter: 60550750206880022
  2. Collapse of all multiple consecutive code digits: 6050750206802
  3. Remove all "0" digits: 65752682

Literature

[edit]

Hans Joachim Postel: Die Kölner Phonetik. Ein Verfahren zur Identifizierung von Personennamen auf der Grundlage der Gestaltanalyse. in: IBM-Nachrichten, 19. Jahrgang, 1969, S. 925-931.

See also

[edit]
[edit]