Algorithm

The algorithm returns:

  • an exception if either argument is null (Score catches and handles this)
  • 0.0 if both strings are of length 0
  • a normalized float (between 0.0 and 1.0) be doing the following:
    1. determine the max length of the two strings
    2. evaluate the two strings using the Damerau-Levenshtein Edit Distance algorithm
    3. normalize the distance by evaluating ((maxLength - damlevDist)/maxLength)

Special Hook Methods

The Damerau-Levenshtein implementation has an additional hook method called distAugment() that takes information about what type of edit this is and the two characters.

The default is to do nothing, but subclasses can override this (as is the case for NormalizedTypoDifference)

  • No labels