TermSimilarityExtensions extension

Extension methods on term that exposes methods for computing similarity.

on

Methods

characterSimilarities(Iterable<String> terms) List<SimilarityIndex>
Returns a ordered list of SimilarityIndex values for the terms, in descending order of SimilarityIndex.similarity.
characterSimilarity(String other) double
Returns the similarity between the collection of letters of this String and other on a scale of 0.0 to 1.0.
characterSimilarityMap(Iterable<String> terms) Map<String, double>
Returns a hashmap of terms to their lengthSimilarity with this.
editDistance(String other) int
Returns the Damerau–Levenshtein distance, the minimum number of single-character edits (transpositions, insertions, deletions or substitutions) required to change one word into another other.
editDistanceMap(Iterable<String> terms) Map<String, int>
Returns a hashmap of terms to their editDistance with this.
editSimilarities(Iterable<String> terms) List<SimilarityIndex>
Returns an ordered list of SimilarityIndex values for the terms, in descending order of SimilarityIndex.similarity.
editSimilarity(String other) double
A normalized measure of editDistance on a scale of 0.0 to 1.0.
editSimilarityMap(Iterable<String> terms) Map<String, double>
Returns a hashmap of terms to their editSimilarity with this.
getSuggestions(Iterable<String> terms, {int limit = 10, int k = 2, double greaterThan = 0.10, int roundTo = 3}) List<SimilarityIndex>
Returns a collection of SimilarityIndexs for this String from terms.
jaccardSimilarities(Iterable<String> terms, [int k = 2]) List<SimilarityIndex>
Returns a ordered list of SimilarityIndex values for the terms, in descending order of SimilarityIndex.similarity using a k-gram length of k. k defaults to 2.
jaccardSimilarity(String other, [int k = 2]) double
Returns the Jaccard Similarity Index between this term and other using a k-gram length of k.
jaccardSimilarityMap(Iterable<String> terms, [int k = 2]) Map<String, double>
Returns a hashmap of terms to Jaccard Similarity Index with this term using a k-gram length of k.
kGrams([int k = 2, bool lowerCase = true]) Set<String>
Returns a set of k-grams in the term.
lengthDistance(String other) int
Returns the absolute value of the difference in length between two terms.
lengthSimilarities(Iterable<String> terms) List<SimilarityIndex>
Returns a ordered list of SimilarityIndex values for the terms, in descending order of SimilarityIndex.similarity.
lengthSimilarity(String other) double
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>
Returns a hashmap of terms to their lengthSimilarity with this.
matches(Iterable<String> terms, {int limit = 10, int k = 2, double greaterThan = 0.10}) List<String>
Returns the best matches for a term from terms, in descending order of term similarity (best match first).
startsWith(Iterable<String> terms, [int limit = 10]) List<String>
Returns a subset of candidates that starts with the same characters as the String.
startsWithSimilarities(Iterable<String> terms) List<SimilarityIndex>
Returns an ordered list of starts-with similarity values for the terms, in descending order of SimilarityIndex.similarity.
startsWithSimilarity(String other) double
Compares the starting charcters of the String with that of other, limiting the comparison to a substring of this or other that is the shorter of this.length or other.length.
startsWithSimilarityMap(Iterable<String> terms) Map<String, double>
Returns a hashmap of cadidate tems to their starts-with similarity with this string.
termSimilarities(Iterable<String> terms, {int k = 2}) List<TermSimilarity>
Returns a ordered list of SimilarityIndex values for the terms, in descending order of SimilarityIndex.similarity.
termSimilarityMap(Iterable<String> terms, {int k = 2}) Map<String, TermSimilarity>
Returns an hashmap of terms to TermSimilarity with this term.