tangentum technologies    
 

Deutsch

   
   
 
    Metaphone (Phonetix)
Phonetix
v0.2

com.tangentum.phonetix
Class Metaphone

java.lang.Object
  |
  +--com.tangentum.phonetix.PhoneticEncoder
        |
        +--com.tangentum.phonetix.MetaphoneEncoder
              |
              +--com.tangentum.phonetix.Metaphone

public final class Metaphone
extends MetaphoneEncoder

Encoder implementing the phonetic algorithm "Metaphone". Metaphone was originally developed by Lawrence Philips. This implementation is based on his original BASIC implementation.

Author:
Claus Engel
See Also:
DoubleMetaphone, Soundex

Field Summary
 
Fields inherited from class com.tangentum.phonetix.MetaphoneEncoder
maxLength
 
Fields inherited from class com.tangentum.phonetix.PhoneticEncoder
EMPTY_KEYS
 
Constructor Summary
Metaphone()
          Constructs a Metaphone encoder which generates keys with maximal length 4.
Metaphone(int maxLength)
          Constructs a Metaphone encoder which generates keys of given maximal length.
 
Method Summary
 java.lang.String generateKey(java.lang.String word)
          Returns the encoding of the given word.
 java.lang.String[] generateKeys(java.lang.String word)
          Returns the encoding of the given word.
static void main(java.lang.String[] argv)
          Test of algorithm with default constructed encoder.
 java.lang.String toString()
          Returns a String identifying the algorithm.
 
Methods inherited from class com.tangentum.phonetix.MetaphoneEncoder
isVowel, match, match
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Metaphone

public Metaphone(int maxLength)
Constructs a Metaphone encoder which generates keys of given maximal length.

Parameters:
maxLength - the maximal length of the generated keys. If negative, the lengths of the keys returned are only limited by the lengths of the words to encode.

Metaphone

public Metaphone()
Constructs a Metaphone encoder which generates keys with maximal length 4.

Method Detail

toString

public java.lang.String toString()
Returns a String identifying the algorithm.

Overrides:
toString in class java.lang.Object

generateKeys

public java.lang.String[] generateKeys(java.lang.String word)
Returns the encoding of the given word.

Specified by:
generateKeys in class PhoneticEncoder
Parameters:
word - the word to encode.
Returns:
an array with the encoding of the word. This is never null.

generateKey

public java.lang.String generateKey(java.lang.String word)
Returns the encoding of the given word.

Specified by:
generateKey in class PhoneticEncoder
Parameters:
word - the word to encode.
Returns:
the encoding of the word. This is never null.

main

public static void main(java.lang.String[] argv)
Test of algorithm with default constructed encoder. The encoded arguments are printed to System.out.


Phonetix
v0.2

Copyright © 1996-2003 Claus Engel. All Rights Reserved.