Package org.apache.commons.codec.language

Examples of org.apache.commons.codec.language.Soundex


      if (value.equals(similarityGroupValue)) {
        return true;
      }
    }

    Soundex soundex = new Soundex();
    RefinedSoundex refinedSoundex = new RefinedSoundex();
    Metaphone metaphone = new Metaphone();

    double threshold;
    if (matchMode == MatchMode.STRICT) {
      threshold = STRICT_SIMILARITY_THRESHOLD;
    } else {
      threshold = LOOSE_SIMILARITY_THRESHOLD;
    }
    int soundexThreshold = (int) Math.round(threshold * 4);

    for (String similarityGroupValue : similarityGroup.getValues()) {
      boolean metaphoneEquals = metaphone.isMetaphoneEqual(value, similarityGroupValue);
      if (metaphoneEquals) {
        return true;
      }

      try {
        int soundexDiff = soundex.difference(value, similarityGroupValue);

        if (soundexDiff >= soundexThreshold) {
          return true;
        }
      } catch (Exception e) {
View Full Code Here


public class StringEncoderComparatorTest {

    @Test
    public void testComparatorWithSoundex() throws Exception {
        final StringEncoderComparator sCompare =
            new StringEncoderComparator( new Soundex() );

        assertTrue( "O'Brien and O'Brian didn't come out with " +
                    "the same Soundex, something must be wrong here",
                    0 == sCompare.compare( "O'Brien", "O'Brian" ) );
    }
View Full Code Here

        new StringEncoderComparator();
    }       

    public void testComparatorWithSoundex() throws Exception {
        StringEncoderComparator sCompare =
            new StringEncoderComparator( new Soundex() );

        assertTrue( "O'Brien and O'Brian didn't come out with " +
                    "the same Soundex, something must be wrong here",
                    0 == sCompare.compare( "O'Brien", "O'Brian" ) );
View Full Code Here

        new StringEncoderComparator();
    }       

    public void testComparatorWithSoundex() throws Exception {
        StringEncoderComparator sCompare =
            new StringEncoderComparator( new Soundex() );

        assertTrue( "O'Brien and O'Brian didn't come out with " +
                    "the same Soundex, something must be wrong here",
                    0 == sCompare.compare( "O'Brien", "O'Brian" ) );
    }
View Full Code Here

  }
 
  public void testEncodes() throws Exception {
    runner( new DoubleMetaphone(), true );
    runner( new Metaphone(), true );
    runner( new Soundex(), true );
    runner( new RefinedSoundex(), true );

    runner( new DoubleMetaphone(), false );
    runner( new Metaphone(), false );
    runner( new Soundex(), false );
    runner( new RefinedSoundex(), false );
  }
View Full Code Here

        new StringEncoderComparator();
    }       

    public void testComparatorWithSoundex() throws Exception {
        StringEncoderComparator sCompare =
            new StringEncoderComparator( new Soundex() );

        assertTrue( "O'Brien and O'Brian didn't come out with " +
                    "the same Soundex, something must be wrong here",
                    0 == sCompare.compare( "O'Brien", "O'Brian" ) );
    }
View Full Code Here

public class SoundexKeyer extends Keyer {

    private Soundex _soundex;

    public SoundexKeyer() {
        _soundex = new Soundex();
    }
View Full Code Here

  }
 
  public void testEncodes() throws Exception {
    runner( new DoubleMetaphone(), true );
    runner( new Metaphone(), true );
    runner( new Soundex(), true );
    runner( new RefinedSoundex(), true );

    runner( new DoubleMetaphone(), false );
    runner( new Metaphone(), false );
    runner( new Soundex(), false );
    runner( new RefinedSoundex(), false );
  }
View Full Code Here

public class StringEncoderComparatorTest {

    @Test
    public void testComparatorWithSoundex() throws Exception {
        StringEncoderComparator sCompare =
            new StringEncoderComparator( new Soundex() );

        assertTrue( "O'Brien and O'Brian didn't come out with " +
                    "the same Soundex, something must be wrong here",
                    0 == sCompare.compare( "O'Brien", "O'Brian" ) );
    }
View Full Code Here

public class StringEncoderComparatorTest {

    @Test
    public void testComparatorWithSoundex() throws Exception {
        final StringEncoderComparator sCompare =
            new StringEncoderComparator( new Soundex() );

        assertTrue( "O'Brien and O'Brian didn't come out with " +
                    "the same Soundex, something must be wrong here",
                    0 == sCompare.compare( "O'Brien", "O'Brian" ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.codec.language.Soundex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.