public static double similarity(String s1,String s2){
  String longer=s1, shorter=s2;
  if (s1.length() < s2.length()) {
    longer=s2;
    shorter=s1;
  }
  int longerLength=longer.length();
  if (longerLength == 0) {
    return 1.0;
  }
  return (longerLength - editDistance(longer,shorter)) / (double)longerLength;
}

public static double similarity ( String s1 , String s2 ) { String longer = s1 , shorter = s2 ; if ( s1 . length ( ) < s2 . length ( ) ) { longer = s2 ; shorter = s1 ; } int longerLength = longer . length ( ) ; if ( longerLength == 0 ) { return 1.0 ; } return ( longerLength - editDistance ( longer , shorter ) ) / ( double ) longerLength ; }
calculates the similarity ( a number within 0 and 1 ) between two strings .
