tfIdfMap method

Map<String, double> tfIdfMap(
  1. Map<String, num> termFrequencies,
  2. int n
)

Returns a hashmap of term to Tf-idf weight for a document.

Implementation

Map<String, double> tfIdfMap(Map<String, num> termFrequencies, int n) {
  final retVal = <String, double>{};
  for (final e in termFrequencies.entries) {
    final f = idFt(e.key, n);
    if (f != null) {
      retVal[e.key] = f;
    }
  }
  return retVal;
}