Word frequency: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: added syntax colouring the hard way) |
No edit summary |
||
Line 2,176: | Line 2,176: | ||
Var L=loadfile("rosettalesmiserables.txt") |
Var L=loadfile("rosettalesmiserables.txt") |
||
L=lcase(L) |
|||
'get deliminators |
'get deliminators |
||
for n as long=1 to 96 |
for n as long=1 to 96 |
||
Line 2,187: | Line 2,188: | ||
string_split(L,deliminators,s()) |
string_split(L,deliminators,s()) |
||
For n As Long=Lbound(s) To ubound(s)'lower case |
|||
s(n)=lcase(s(n)) |
|||
Next |
|||
quicksort(s(),lbound(s),ubound(s)) |
quicksort(s(),lbound(s),ubound(s)) |
||
Line 2,208: | Line 2,205: | ||
print "frequency","word" |
print "frequency","word" |
||
print |
print |
||
for n as long=lbound(t) to lbound(t)+ |
for n as long=lbound(t) to lbound(t)+9 |
||
print t(n).l,t(n).s |
print t(n).l,t(n).s |
||
next |
next |
||
Line 2,219: | Line 2,216: | ||
<pre> |
<pre> |
||
I saved and reloaded the file as ascii text. |
I saved and reloaded the file as ascii text. |
||
frequency word |
frequency word |
||
41098 the |
|||
19955 of |
|||
14939 and |
|||
14557 a |
|||
13953 to |
|||
11219 in |
|||
9648 he |
|||
8621 was |
|||
7923 that |
|||
6660 it |
|||
6360 is |
|||
⚫ | |||
⚫ | |||
</pre> |
</pre> |
||