Package org.apache.commons.text.similarity
package org.apache.commons.text.similarity
Provides algorithms for string similarity.
The algorithms that implement the EditDistance interface follow the same simple principle: the more similar (closer) strings are, lower is the distance. For example, the words house and hose are closer than house and trousers.
The following algorithms are available at the moment:
Cosine Distance
Cosine Similarity
Fuzzy Score
Hamming Distance
Jaro-Winkler Distance
Jaro-Winkler Similarity
Levenshtein Distance
Longest Common Subsequence Distance
The Cosine Distance
utilises a regular expression tokenizer (\w+)
.
And the Levenshtein Distance
's
behavior can be changed to take into consideration a maximum throughput.
- Since:
- 1.0
-
ClassDescriptionMeasures the cosine distance between two character sequences.Measures the Cosine similarity of two vectors of an inner product space and compares the angle between them.EditDistance<R>Interface for Edit Distances.This stores a
EditDistance
implementation and aCharSequence
"left" string.A matching algorithm that is similar to the searching algorithms implemented in editors such as Sublime Text, TextMate, Atom and others.The hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different.Represents the intersection result between two sets.Measures the intersection of two sets created from a pair of character sequences.Measures the Jaccard distance of two sets of character sequence.Measures the Jaccard similarity (aka Jaccard index) of two sets of character sequence.Measures the Jaro-Winkler distance of two character sequences.A similarity algorithm indicating the percentage of matched characters between two character sequences.An algorithm for measuring the difference between two character sequences.An algorithm for measuring the difference between two character sequences.Container class to store Levenshtein distance between two character sequences.A similarity algorithm indicating the length of the longest common subsequence between two strings.An edit distance algorithm based on the length of the longest common subsequence between two strings.Interface for the concept of a string similarity score.This stores aSimilarityScore
implementation and aCharSequence
"left" string.