Class EditDistance

java.lang.Object
org.languagetool.rules.spelling.symspell.implementation.EditDistance

public class EditDistance extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    private String
     
    private int[]
     
    private int[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new EditDistance object. The base string to which other strings will be compared. The desired edit distance algorithm.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compare(String string2, int maxDistance)

    using the previously selected algorithm.

    The string to compare. The maximum distance allowed. The edit distance (or -1 if maxDistance exceeded).
    int
    DamerauLevenshteinDistance(String string2, int maxDistance)
    String being compared for distance. String being compared against other string. The maximum edit distance of interest. int edit distance, >= 0 representing the number of edits required to transform one string to the other, or -1 if the distance is greater than the specified maxDistance.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • EditDistance

      public EditDistance(String baseString, EditDistance.DistanceAlgorithm algorithm)
      Create a new EditDistance object. The base string to which other strings will be compared. The desired edit distance algorithm.
  • Method Details

    • compare

      public int compare(String string2, int maxDistance)

      using the previously selected algorithm.

      The string to compare. The maximum distance allowed. The edit distance (or -1 if maxDistance exceeded).
    • DamerauLevenshteinDistance

      public int DamerauLevenshteinDistance(String string2, int maxDistance)
      String being compared for distance. String being compared against other string. The maximum edit distance of interest. int edit distance, >= 0 representing the number of edits required to transform one string to the other, or -1 if the distance is greater than the specified maxDistance.