startsWithSimilarityMap method

Map<String, double> startsWithSimilarityMap(
  1. Iterable<String> terms
)

Returns a hashmap of cadidate tems to their starts-with similarity with this string.

Not case sensitive.

Implementation

Map<String, double> startsWithSimilarityMap(Iterable<String> terms) {
  final retVal = <String, double>{};
  final term = trim().toLowerCase();
  final values = terms.map((e) => e.trim().toLowerCase()).toSet();
  for (final other in values) {
    retVal[other] = term.startsWithSimilarity(other);
  }
  return retVal;
}