Package Services.Dependencies
Class LCS
java.lang.Object
Services.Dependencies.LCS
Utility class for computing the Longest Common Substring (LCS) similarity
between two character sequences.
This implementation returns a normalized similarity value between 0 and 1, calculated as the length of the longest common substring divided by the maximum length of the two input sequences.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic floatLCSubStr(char[] X, char[] Y, int m, int n) Computes the normalized longest common substring (LCS) similarity between two character arrays.
-
Constructor Details
-
LCS
public LCS()
-
-
Method Details
-
LCSubStr
public static float LCSubStr(char[] X, char[] Y, int m, int n) Computes the normalized longest common substring (LCS) similarity between two character arrays.The method uses dynamic programming to calculate the length of the longest contiguous substring shared by
XandY. The result is then normalized by dividing by the maximum length of the two input arrays.- Parameters:
X- first character arrayY- second character arraym- length of the first arrayXn- length of the second arrayY- Returns:
- a float value between 0 and 1 representing the normalized longest common substring similarity
-