TermSimilarity class Null safety

A static/abstract class that exposes methods for computing similarity of terms.

Implementers

Constructors

TermSimilarity(String term, String other, {int k = 2})
Returns a immutable TermSimilarity for term and other.
factory

Properties

characterSimilarity double
Returns the similarity between the collection of letters of term and other on a scale of 0.0 to 1.0.
read-only
editDistance int
Returns the Damerau–Levenshtein distance, the minimum number of single-character edits (transpositions, insertions, deletions or substitutions) required to change term into other.
read-only
editSimilarity double
A normalized measure of editDistance on a scale of 0.0 to 1.0.
read-only
hashCode int
The hash code for this object.
read-only, inherited
jaccardSimilarity double
Returns the Jaccard Similarity Index between term and other.
read-only
lengthDistance int
Returns the absolute value of the difference in length between term and other.
read-only
lengthSimilarity 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))
read-only
other String
The term that is being compared to term.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
similarity double
The compound similarity value on a scale of 0.0 to 1.0.
read-only
startsWithSimilarity 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. ///
read-only
term String
The term that is being compared to other.
read-only

Methods

compareTo(TermSimilarity other) int
Compares this to other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes the TermSimilarity to Map<String, dynamic>.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

characterSimilarities(String term, Iterable<String> terms) List<SimilarityIndex>
Returns a ordered list of SimilarityIndex values for the terms, in descending order of SimilarityIndex.similarity.
editDistanceMap(String term, Iterable<String> terms) Map<String, int>
Returns a hashmap of terms to their editDistance with this.
editSimilarities(String term, Iterable<String> terms) List<SimilarityIndex>
Returns a ordered list of SimilarityIndex values of term to the terms in descending order of SimilarityIndex.similarity.
getSuggestions(String term, Iterable<String> terms, {int limit = 10, int k = 2, double greaterThan = 0.10}) List<SimilarityIndex>
Returns a collection of SimilarityIndexs for this String from terms.
jaccardSimilarities(String term, Iterable<String> terms, [int k = 2]) List<SimilarityIndex>
Returns a ordered list of SimilarityIndex values of term to the terms in descending order of SimilarityIndex.similarity using a k-gram length of k. k defaults to 2.
kGrams(String term, [int k = 2]) Set<String>
Returns a set of (lower-case) k-grams in the term.
lengthSimilarities(String term, Iterable<String> terms) List<SimilarityIndex>
Returns a ordered list of SimilarityIndex values for the terms, in descending order of SimilarityIndex.similarity.
matches(String term, 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).
startsWithSimilarities(String term, Iterable<String> terms) List<SimilarityIndex>
Returns a ordered list of SimilarityIndex values for the terms, in descending order of SimilarityIndex.similarity.
termSimilarities(String term, 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(String term, Iterable<String> terms, {int k = 2}) Map<String, TermSimilarity>
Returns an hashmap of terms to TermSimilarity with term.