java.lang.Object
org.xbib.interlibrary.catalog.matching.string.MetaphoneEncoder
Alle implementierten Schnittstellen:
StringEncoder

public class MetaphoneEncoder extends Object implements StringEncoder
A class to generate phonetic code. The initial Java implementation, William B. Brogden. December, 1997 Permission given by wbrogden for code to be used anywhere. "Hanging on the Metaphone" by Lawrence Philips Computer Language of Dec. 1990, p 39
  • Konstruktordetails

    • MetaphoneEncoder

      public MetaphoneEncoder()
  • Methodendetails

    • encode

      public String encode(String txt) throws EncoderException
      Find the metaphone value of a String. This is similar to the soundex algorithm, but better at finding similar sounding words. All input is converted to upper case. Limitations: Input format is expected to be a single ASCII word with only characters in the A - Z range, no punctuation or numbers.
      Angegeben von:
      encode in Schnittstelle StringEncoder
      Parameter:
      txt - String to find the metaphone code for
      Gibt zurück:
      A metaphone code corresponding to the String supplied
      Löst aus:
      EncoderException - if there is an error condition during the encoding process.
    • isMetaphoneEqual

      public boolean isMetaphoneEqual(String str1, String str2)
      Tests is the metaphones of two strings are identical.
      Parameter:
      str1 - First of two strings to compare
      str2 - Second of two strings to compare
      Gibt zurück:
      true if the metaphones of these strings are identical, false otherwise.
    • getMaxCodeLen

      public int getMaxCodeLen()
      Returns the maxCodeLen.
      Gibt zurück:
      int
    • setMaxCodeLen

      public void setMaxCodeLen(int maxCodeLen)
      Sets the maxCodeLen.
      Parameter:
      maxCodeLen - The maxCodeLen to set