|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.codec.language.ColognePhonetic
public class ColognePhonetic
Encodes a string into a Cologne Phonetic value.
Implements the “Kölner Phonetic” (Cologne Phonetic) algorithm issued by Hans Joachim Postel in 1969.
The Kölner Phonetik is a phonetic algorithm which is optimized for the German language. It is related to the well-known soundex algorithm.
Letter | Context | Code |
---|---|---|
A, E, I, J, O, U, Y | 0 | |
H | - | |
B | 1 | |
P | not before H | |
D, T | not before C, S, Z | 2 |
F, V, W | 3 | |
P | before H | |
G, K, Q | 4 | |
C | at onset before A, H, K, L, O, Q, R, U, X | |
before A, H, K, O, Q, U, X except after S, Z | ||
X | not after C, K, Q | 48 |
L | 5 | |
M, N | 6 | |
R | 7 | |
S, Z | 8 | |
C | after S, Z | |
at onset except before A, H, K, L, O, Q, R, U, X | ||
not before A, H, K, O, Q, U, X | ||
D, T | before C, S, Z | |
X | after C, K, Q |
(Source: Wikipedia (de): Kölner Phonetik – Buchstabencodes)
"Müller-Lüdenscheidt" => "MULLERLUDENSCHEIDT" => "6005507500206880022"
"6005507500206880022" => "6050750206802"
"6050750206802" => "65752682"
Nested Class Summary | |
---|---|
private class |
ColognePhonetic.CologneBuffer
|
private class |
ColognePhonetic.CologneInputBuffer
|
private class |
ColognePhonetic.CologneOutputBuffer
|
Field Summary | |
---|---|
private static char[][] |
PREPROCESS_MAP
|
Constructor Summary | |
---|---|
ColognePhonetic()
|
Method Summary | |
---|---|
private static boolean |
arrayContains(char[] arr,
char key)
|
java.lang.String |
colognePhonetic(java.lang.String text)
colognePhonetic() is the actual implementations of the Kölner Phonetik algorithm. |
java.lang.Object |
encode(java.lang.Object object)
Encodes an "Object" and returns the encoded content as an Object. |
java.lang.String |
encode(java.lang.String text)
Encodes a String and returns a String. |
boolean |
isEncodeEqual(java.lang.String text1,
java.lang.String text2)
|
private java.lang.String |
preprocess(java.lang.String text)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final char[][] PREPROCESS_MAP
Constructor Detail |
---|
public ColognePhonetic()
Method Detail |
---|
private static boolean arrayContains(char[] arr, char key)
public java.lang.String colognePhonetic(java.lang.String text)
colognePhonetic() is the actual implementations of the Kölner Phonetik algorithm.
In contrast to the initial description of the algorithm, this implementation does the encoding in one pass.
text
-
public java.lang.Object encode(java.lang.Object object) throws EncoderException
Encoder
byte[]
or String
s depending on the implementation used.
encode
in interface Encoder
object
- An object ot encode
EncoderException
- an encoder exception is
thrown if the encoder experiences a failure
condition during the encoding process.public java.lang.String encode(java.lang.String text)
StringEncoder
encode
in interface StringEncoder
text
- the String to encode
public boolean isEncodeEqual(java.lang.String text1, java.lang.String text2)
private java.lang.String preprocess(java.lang.String text)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |