Package org.apache.commons.codec.language

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

@author Benjamin Walstrum @author Gary Gregory @version $Id: DoubleMetaphone.java,v 1.14 2003/11/07 23:12:54 ggregory Exp $

    params.set("input", inputDir);
    params.set("output", outputDir);
    params.set("selectedField", "1"); // tweet
    params.set("groupByField", "0"); // username
    ByKeyGroupingJob.startJob(params);
    DoubleMetaphone filter = new DoubleMetaphone();
// TODO: change these terms?!
    System.out.println(filter.encode("Loke"));
    System.out.println(filter.encode("companymancomic"));
    System.out.println(filter.encode("webcomics"));
    System.out.println(filter.encode("@comic"));
  }
View Full Code Here


                    0 == sCompare.compare( "O'Brien", "O'Brian" ) );
    }

    @Test
    public void testComparatorWithDoubleMetaphone() throws Exception {
        final StringEncoderComparator sCompare = new StringEncoderComparator(new DoubleMetaphone());

        final String[] testArray = { "Jordan", "Sosa", "Prior", "Pryor" };
        final List<String> testList = Arrays.asList(testArray);

        final String[] controlArray = { "Jordan", "Prior", "Pryor", "Sosa" };
View Full Code Here

    }

    @Test
    public void testComparatorWithDoubleMetaphoneAndInvalidInput() throws Exception {
        final StringEncoderComparator sCompare =
            new StringEncoderComparator( new DoubleMetaphone() );

        final int compare = sCompare.compare(new Double(3.0), Long.valueOf(3));
        assertEquals( "Trying to compare objects that make no sense to the underlying encoder should return a zero compare code",
                                0, compare);
    }
View Full Code Here

                    0 == sCompare.compare( "O'Brien", "O'Brian" ) );
    }
   
    public void testComparatorWithDoubleMetaphone() throws Exception {
        StringEncoderComparator sCompare =
            new StringEncoderComparator( new DoubleMetaphone() );
           
        String[] testArray = { "Jordan", "Sosa", "Prior", "Pryor" };
        List testList = Arrays.asList( testArray );       
       
        String[] controlArray = { "Jordan", "Prior", "Pryor", "Sosa" };
View Full Code Here

        }
    }

    public void testComparatorWithDoubleMetaphoneAndInvalidInput() throws Exception {
        StringEncoderComparator sCompare =
            new StringEncoderComparator( new DoubleMetaphone() );
          
        int compare = sCompare.compare(new Double(3.0), new Long(3));
        assertEquals( "Trying to compare objects that make no sense to the underlying encoder should return a zero compare code",
                                0, compare);       
       
View Full Code Here

    }
    assertNull( filter.next() )// no more tokens
  }
 
  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

                    0 == sCompare.compare( "O'Brien", "O'Brian" ) );
    }
   
    public void testComparatorWithDoubleMetaphone() throws Exception {
        StringEncoderComparator sCompare =
            new StringEncoderComparator( new DoubleMetaphone() );
           
        String[] testArray = { "Jordan", "Sosa", "Prior", "Pryor" };
        List testList = Arrays.asList( testArray );       
       
        String[] controlArray = { "Jordan", "Prior", "Pryor", "Sosa" };
View Full Code Here

        }
    }

    public void testComparatorWithDoubleMetaphoneAndInvalidInput() throws Exception {
        StringEncoderComparator sCompare =
            new StringEncoderComparator( new DoubleMetaphone() );
          
        int compare = sCompare.compare(new Double(3.0), new Long(3));
        assertEquals( "Trying to compare objects that make no sense to the underlying encoder should return a zero compare code",
                                0, compare);       
       
View Full Code Here

public class DoubleMetaphoneKeyer extends Keyer {

    private DoubleMetaphone _metaphone2;

    public DoubleMetaphoneKeyer() {
        _metaphone2 = new DoubleMetaphone();
        _metaphone2.setMaxCodeLen(2000);
    }
View Full Code Here

    }
    assertNull( filter.next() )// no more tokens
  }
 
  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

TOP

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

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.