Class Sift4
- java.lang.Object
-
- info.debatty.java.stringsimilarity.experimental.Sift4
-
- All Implemented Interfaces:
StringDistance
,java.io.Serializable
public class Sift4 extends java.lang.Object implements StringDistance
Sift4 - a general purpose string distance algorithm inspired by JaroWinkler and Longest Common Subsequence. Original JavaScript algorithm by siderite, java port by Nathan Fischer 2016. https://siderite.dev/blog/super-fast-and-accurate-string-distance.html https://blackdoor.github.io/blog/sift4-java/- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static int
DEFAULT_MAX_OFFSET
private int
max_offset
-
Constructor Summary
Constructors Constructor Description Sift4()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
distance(java.lang.String s1, java.lang.String s2)
Sift4 - a general purpose string distance algorithm inspired by JaroWinkler and Longest Common Subsequence.void
setMaxOffset(int max_offset)
Set the maximum distance to search for character transposition.
-
-
-
Field Detail
-
DEFAULT_MAX_OFFSET
private static final int DEFAULT_MAX_OFFSET
- See Also:
- Constant Field Values
-
max_offset
private int max_offset
-
-
Method Detail
-
setMaxOffset
public final void setMaxOffset(int max_offset)
Set the maximum distance to search for character transposition. Compute cost of algorithm is O(n . max_offset)- Parameters:
max_offset
-
-
distance
public final double distance(java.lang.String s1, java.lang.String s2)
Sift4 - a general purpose string distance algorithm inspired by JaroWinkler and Longest Common Subsequence. Original JavaScript algorithm by siderite, java port by Nathan Fischer 2016. https://siderite.dev/blog/super-fast-and-accurate-string-distance.html https://blackdoor.github.io/blog/sift4-java/- Specified by:
distance
in interfaceStringDistance
- Parameters:
s1
-s2
-- Returns:
-
-