Word frequency: Difference between revisions
PascalABC.NET
(K) |
(PascalABC.NET) |
||
(One intermediate revision by one other user not shown) | |||
Line 3,401:
7924 that
6661 it
</pre>
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
##
ReadAllText('135-0.txt').ToLower.MatchValues('\w+').EachCount
.OrderByDescending(w -> w.Value).Take(10).PrintLines
</syntaxhighlight>
{{out}}
<pre>
(the,41042)
(of,19952)
(and,14938)
(a,14527)
(to,13942)
(in,11208)
(he,9646)
(was,8620)
(that,7922)
(it,6659)
</pre>
Line 5,437 ⟶ 5,457:
I've taken the view that 'letter' means either a letter or digit for Unicode codepoints up to 255. I haven't included underscore, hyphen nor apostrophe as these usually separate compound words.
Not very quick (runs in about
If the Go example is re-run today (
<syntaxhighlight lang="
import "./str" for Str
import "./sort" for Sort
import "./fmt" for Fmt
import "./pattern" for Pattern
var fileName = "135-0.txt"
|