org.apache.commons.codec.language
Class ColognePhonetic

java.lang.Object
  extended by org.apache.commons.codec.language.ColognePhonetic
All Implemented Interfaces:
Encoder, StringEncoder

public class ColognePhonetic
extends Object
implements StringEncoder

Encodes a string into a Cologne Phonetic value.

Implements the Kölner Phonetik (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.

Algorithm

This class is thread-safe.

Since:
1.5
See Also:
Wikipedia (de): Kölner Phonetik (in German)

Constructor Summary
ColognePhonetic()
           
 
Method Summary
 String colognePhonetic(String text)
           Implements the Kölner Phonetik algorithm.
 Object encode(Object object)
          Encodes an "Object" and returns the encoded content as an Object.
 String encode(String text)
          Encodes a String and returns a String.
 boolean isEncodeEqual(String text1, String text2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColognePhonetic

public ColognePhonetic()
Method Detail

colognePhonetic

public String colognePhonetic(String text)

Implements the Kölner Phonetik algorithm.

In contrast to the initial description of the algorithm, this implementation does the encoding in one pass.

Parameters:
text -
Returns:
the corresponding encoding according to the Kölner Phonetik algorithm

encode

public Object encode(Object object)
              throws EncoderException
Description copied from interface: Encoder
Encodes an "Object" and returns the encoded content as an Object. The Objects here may just be byte[] or Strings depending on the implementation used.

Specified by:
encode in interface Encoder
Parameters:
object - An object to encode
Returns:
An "encoded" Object
Throws:
EncoderException - An encoder exception is thrown if the encoder experiences a failure condition during the encoding process.

encode

public String encode(String text)
Description copied from interface: StringEncoder
Encodes a String and returns a String.

Specified by:
encode in interface StringEncoder
Parameters:
text - the String to encode
Returns:
the encoded String

isEncodeEqual

public boolean isEncodeEqual(String text1,
                             String text2)


Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.