jaccardSimilarityMap method

Map<String, double> jaccardSimilarityMap(
  1. Iterable<String> terms, [
  2. int k = 2
])

Returns a hashmap of terms to Jaccard Similarity Index with this term using a k-gram length of k.

Not case-sensitive.

Implementation

Map<String, double> jaccardSimilarityMap(Iterable<String> terms,
    [int k = 2]) {
  final retVal = <String, double>{};
  final termGrams = kGrams(k);
  for (final other in terms) {
    retVal[other] = _jaccardSimilarity(termGrams, other, k);
  }
  return retVal;
}