com.datumbox.framework.core.common.text.analyzers
Class PHPSimilarText
- java.lang.Object
-
- com.datumbox.framework.core.common.text.analyzers.PHPSimilarText
-
public class PHPSimilarText extends java.lang.ObjectEstimates the similarity of two strings. I ported from php's similar_text() method which is written in C and it's original code can be found on: http://stackoverflow.com/questions/14136349/how-does-similar-text-work
-
-
Constructor Summary
Constructors Constructor and Description PHPSimilarText()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static intsimilarityChars(java.lang.String txt1, java.lang.String txt2)Checks the similarity of two strings and returns the number of matching chars in both strings.static doublesimilarityPercentage(java.lang.String txt1, java.lang.String txt2)Checks the similarity of two strings and returns their similarity percentage.
-
-
-
Method Detail
-
similarityChars
public static int similarityChars(java.lang.String txt1, java.lang.String txt2)Checks the similarity of two strings and returns the number of matching chars in both strings.- Parameters:
txt1-txt2-- Returns:
-
similarityPercentage
public static double similarityPercentage(java.lang.String txt1, java.lang.String txt2)Checks the similarity of two strings and returns their similarity percentage.- Parameters:
txt1-txt2-- Returns:
-
-
DataMelt 3.0 © DataMelt by jWork.ORG