getMostFrequent method

List<MapEntry<String, int>> getMostFrequent(
  1. int n
)

Returns the n most frequently occurring concepts.

Implementation

List<MapEntry<String, int>> getMostFrequent(int n) {
  final sorted = _conceptFreq.entries.toList()
    ..sort((a, b) => b.value.compareTo(a.value));
  return sorted.take(n).toList();
}