Class NormalizedLevenshtein

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Levenshtein l  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double distance​(java.lang.String s1, java.lang.String s2)
      Compute distance as Levenshtein(s1, s2) / max(|s1|, |s2|).
      double similarity​(java.lang.String s1, java.lang.String s2)
      Return 1 - distance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NormalizedLevenshtein

        public NormalizedLevenshtein()
    • Method Detail

      • distance

        public final double distance​(java.lang.String s1,
                                     java.lang.String s2)
        Compute distance as Levenshtein(s1, s2) / max(|s1|, |s2|).
        Specified by:
        distance in interface StringDistance
        Parameters:
        s1 - The first string to compare.
        s2 - The second string to compare.
        Returns:
        The computed distance in the range [0, 1]
        Throws:
        java.lang.NullPointerException - if s1 or s2 is null.
      • similarity

        public final double similarity​(java.lang.String s1,
                                       java.lang.String s2)
        Return 1 - distance.
        Specified by:
        similarity in interface StringSimilarity
        Parameters:
        s1 - The first string to compare.
        s2 - The second string to compare.
        Returns:
        1.0 - the computed distance
        Throws:
        java.lang.NullPointerException - if s1 or s2 is null.