public class LongestCommonSubsequenceDistance extends Object implements EditDistance<Integer>
This code is directly based upon the implementation in LongestCommonSubsequence.
For reference see: https://en.wikipedia.org/wiki/Longest_common_subsequence_problem.
For further reading see:
Lothaire, M. Applied combinatorics on words. New York: Cambridge U Press, 2005. 12-13
| Constructor and Description |
|---|
LongestCommonSubsequenceDistance() |
| Modifier and Type | Method and Description |
|---|---|
Integer |
apply(CharSequence left,
CharSequence right)
Calculates an edit distance between two
CharSequence's left and
right as: left.length() + right.length() - 2 * LCS(left, right), where
LCS is given in LongestCommonSubsequence.apply(CharSequence, CharSequence). |
public Integer apply(CharSequence left, CharSequence right)
CharSequence's left and
right as: left.length() + right.length() - 2 * LCS(left, right), where
LCS is given in LongestCommonSubsequence.apply(CharSequence, CharSequence).apply in interface EditDistance<Integer>apply in interface SimilarityScore<Integer>left - first character sequenceright - second character sequenceIllegalArgumentException - if either String input nullCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.