Source Code : Codec Language

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Codec Language

import org.apache.commons.codec.*;
import org.apache.commons.codec.language.*;

public class LanguageUsage{

  public static void main(String args[]){
    LanguageUsage codec = new LanguageUsage();
    try{
      codec.start();
    }catch(Exception e){
      System.err.println(e);
    }
  }

  public void start() throws EncoderException, DecoderException{

    String word1 = "Wilson";
    String word2 = "Wylson";
    String foreignWord1 = "Otto";
    String foreignWord2 = "Auto";

    Soundex sndx = new Soundex();
    DoubleMetaphone doubleMetaphone = new DoubleMetaphone();

    System.err.println("Soundex Code for Wilson is: " + sndx.encode("Wilson"));
    System.err.println("Soundex Code for Wylson is: " + sndx.encode("Wylson"));

    // Use the StringEncoderComparator to compare these two Strings
    StringEncoderComparator comparator1 = new StringEncoderComparator(sndx);
    System.err.println("Are Wilson and Wylson same based on Soundex? "
      + comparator1.compare("Wilson", "Wylson"));

    System.err.println("Are Auto and Otto same based on Soundex? "
      + comparator1.compare("Auto", "Otto"));

    StringEncoderComparator comparator2 =
      new StringEncoderComparator(doubleMetaphone);

    System.err.println("Are Auto and Otto same based on DoubleMetaphone? "
      + comparator2.compare("Auto", "Otto"));

    System.err.println("Double Metaphone primary code for Schmidt: " +
      doubleMetaphone.doubleMetaphone("Schmidt"));

    System.err.println("Double Metaphone secondary code for Schmidt: " +
      doubleMetaphone.doubleMetaphone("Schmidt", true));

  }
}
           
       

Thank with us