TermSimilarityExtensions extension
Extension methods on term that exposes methods for computing similarity.
- on
Methods
-
characterSimilarities(
Iterable< String> terms) → List<SimilarityIndex> -
Available on String, provided by the TermSimilarityExtensions extension
Returns a ordered list of SimilarityIndex values for theterms
, in descending order of SimilarityIndex.similarity. -
characterSimilarity(
String other) → double -
Available on String, provided by the TermSimilarityExtensions extension
Returns the similarity between the collection of letters of this String andother
on a scale of 0.0 to 1.0. -
characterSimilarityMap(
Iterable< String> terms) → Map<String, double> -
Available on String, provided by the TermSimilarityExtensions extension
Returns a hashmap ofterms
to their lengthSimilarity with this. -
editDistance(
String other) → int -
Available on String, provided by the TermSimilarityExtensions extension
Returns theDamerau–Levenshtein distance
, the minimum number of single-character edits (transpositions, insertions, deletions or substitutions) required to change one word into anotherother
. -
editDistanceMap(
Iterable< String> terms) → Map<String, int> -
Available on String, provided by the TermSimilarityExtensions extension
Returns a hashmap ofterms
to their editDistance with this. -
editSimilarities(
Iterable< String> terms) → List<SimilarityIndex> -
Available on String, provided by the TermSimilarityExtensions extension
Returns an ordered list of SimilarityIndex values for the terms, in descending order of SimilarityIndex.similarity. -
editSimilarity(
String other) → double -
Available on String, provided by the TermSimilarityExtensions extension
A normalized measure of editDistance on a scale of 0.0 to 1.0. -
editSimilarityMap(
Iterable< String> terms) → Map<String, double> -
Available on String, provided by the TermSimilarityExtensions extension
Returns a hashmap ofterms
to their editSimilarity with this. -
getSuggestions(
Iterable< String> terms, {int limit = 10, int k = 2, double greaterThan = 0.10, int roundTo = 3}) → List<SimilarityIndex> -
Available on String, provided by the TermSimilarityExtensions extension
Returns a collection of SimilarityIndexs for this String fromterms
. -
jaccardSimilarities(
Iterable< String> terms, [int k = 2]) → List<SimilarityIndex> -
Available on String, provided by the TermSimilarityExtensions extension
Returns a ordered list of SimilarityIndex values for theterms
, in descending order of SimilarityIndex.similarity using ak
-gram length ofk
.k
defaults to 2. -
jaccardSimilarity(
String other, [int k = 2]) → double -
Available on String, provided by the TermSimilarityExtensions extension
Returns the Jaccard Similarity Index between this term andother
using ak
-gram length ofk
. -
jaccardSimilarityMap(
Iterable< String> terms, [int k = 2]) → Map<String, double> -
Available on String, provided by the TermSimilarityExtensions extension
Returns a hashmap ofterms
to Jaccard Similarity Index with this term using ak
-gram length ofk
. -
kGrams(
[int k = 2, bool lowerCase = true]) → Set< String> -
Available on String, provided by the TermSimilarityExtensions extension
Returns a set of k-grams in the term. -
lengthDistance(
String other) → int -
Available on String, provided by the TermSimilarityExtensions extension
Returns the absolute value of the difference in length between two terms. -
lengthSimilarities(
Iterable< String> terms) → List<SimilarityIndex> -
Available on String, provided by the TermSimilarityExtensions extension
Returns a ordered list of SimilarityIndex values for theterms
, in descending order of SimilarityIndex.similarity. -
lengthSimilarity(
String other) → double -
Available on String, provided by the TermSimilarityExtensions extension
Returns the similarity in length between two terms, defined as: lengthSimilarity = 1 minus the log of the ratio between the term lengths, with a floor at 0.0:1-(log(this.length/other.length))
-
lengthSimilarityMap(
Iterable< String> terms) → Map<String, double> -
Available on String, provided by the TermSimilarityExtensions extension
Returns a hashmap ofterms
to their lengthSimilarity with this. -
matches(
Iterable< String> terms, {int limit = 10, int k = 2, double greaterThan = 0.10}) → List<String> -
Available on String, provided by the TermSimilarityExtensions extension
Returns the best matches for a term fromterms
, in descending order of term similarity (best match first). -
startsWith(
Iterable< String> terms, [int limit = 10]) → List<String> -
Available on String, provided by the TermSimilarityExtensions extension
Returns a subset of candidates that starts with the same characters as the String. -
startsWithSimilarities(
Iterable< String> terms) → List<SimilarityIndex> -
Available on String, provided by the TermSimilarityExtensions extension
Returns an ordered list of starts-with similarity values for the terms, in descending order of SimilarityIndex.similarity. -
startsWithSimilarity(
String other) → double -
Available on String, provided by the TermSimilarityExtensions extension
Compares the starting charcters of the String with that ofother
, limiting the comparison to a substring of this orother
that is the shorter of this.length or other.length. -
startsWithSimilarityMap(
Iterable< String> terms) → Map<String, double> -
Available on String, provided by the TermSimilarityExtensions extension
Returns a hashmap of cadidate tems to their starts-with similarity with this string. -
termSimilarities(
Iterable< String> terms, {int k = 2}) → List<TermSimilarity> -
Available on String, provided by the TermSimilarityExtensions extension
Returns a ordered list of SimilarityIndex values for theterms
, in descending order of SimilarityIndex.similarity. -
termSimilarityMap(
Iterable< String> terms, {int k = 2}) → Map<String, TermSimilarity> -
Available on String, provided by the TermSimilarityExtensions extension
Returns an hashmap ofterms
to TermSimilarity with this term.