getSuggestions static method

List<SimilarityIndex> getSuggestions(
  1. String term,
  2. Iterable<String> terms, {
  3. int limit = 10,
  4. int k = 2,
  5. double greaterThan = 0.10,
})

Returns a collection of SimilarityIndexs for this String from terms.

Similarity is calculated for each term in terms by starting with 1.0 and iteratively multiplying by lengthSimilarity, characterSimilarity, jaccardSimilarity and editSimilarity, terminating the iteration as soon as the greaterThan threshold is reached.

The default greaterThan is 0.10. A higher value for greaterThan can improve performance as candidates with different lengths to this term are not evaluated, avoiding costly computation of edit distance and or Jaccard similarity.

Suggestions are returned in descending order of similarity.

The top returned matches will be limited to limit if more than limit matches are found.

Not case-sensitive.

Implementation

static List<SimilarityIndex> getSuggestions(
        String term, Iterable<String> terms,
        {int limit = 10, int k = 2, double greaterThan = 0.10}) =>
    term.getSuggestions(terms, greaterThan: greaterThan, k: k);