Soli at the edge

Try it

Paste some text. The statistics below are computed by a Soli controller, inside the Worker that answered this request.

18 words
12 distinct
85 characters
4.7s to read

Most frequent

  1. fast × 3
  2. soli × 2
  3. the × 2
  4. edge × 2
  5. is × 2

Longest word: close

The code

words = text.downcase.split(" ")
  .map { |w| w.gsub("[^a-z0-9'-]", "") }
  .filter { |w| w.length > 0 }
counts = {}
words.each do |w|
  counts[w] = (counts[w] ?? 0) + 1
end
top = counts.keys.sort_by { |w| -counts[w] }.take(5)