RosettaCodeData/Task/Word-frequency/KAP/word-frequency.kap

8 lines
257 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
∇ stats (file) {
content ← "[\\h,.\"'\n-]+" regex:split unicode:toLower io:readFile file
sorted ← (⍋⊇⊢) content
selection ← 1,2≢/sorted
words ← selection / sorted
{⍵[10↑⍒⍵[;1];]} words ,[0.5] ≢¨ sorted ⊂⍨ +\selection
}