matches method Null safety
Returns the best matches for the Term from terms, in descending
order of termSimilarity (best match first).
Only matches with a termSimilarity > 0.0 are returned.
The returned matches will be limited to limit if more than limit
matches are found.
Implementation
List<Term> matches(Iterable<Term> terms, {int k = 3, int limit = 10}) {
final similarities = termSimilarityMap(terms);
final entries =
similarities.entries.where((element) => element.value > 0).toList();
entries.sort(((a, b) => b.value.compareTo(a.value)));
final retVal = entries.map((e) => e.key).toList();
return retVal.length > limit ? retVal.sublist(0, limit) : retVal;
}