Word frequency: Difference between revisions
Content added Content deleted
m (→version 1: added an informative message stating how many words found in the number of records and the filename used.) |
|||
Line 298: | Line 298: | ||
end /*while*/ |
end /*while*/ |
||
end /*#*/ |
end /*#*/ |
||
say |
say commas(c) ' words found in ' commas(#-1) ' records read from the file: ' fID |
||
say |
|||
⚫ | |||
say right('word', 40) " " center(' rank ', 6) " count " /*display title for output*/ |
|||
⚫ | |||
/* [↓] note the BY incr.*/ |
/* [↓] note the BY incr.*/ |
||
do tops=1 by 0 until otops==tops|tops>top /*process enough words to satisfy TOP.*/ |
do tops=1 by 0 until otops==tops|tops>top /*process enough words to satisfy TOP.*/ |
||
Line 313: | Line 315: | ||
wr=max( length(' rank '), length(top) ) /*find the maximum length of the rank #*/ |
wr=max( length(' rank '), length(top) ) /*find the maximum length of the rank #*/ |
||
do d=1 for words(tl); _=word(tl, d) /*process each of the words in the TL. */ |
do d=1 for words(tl); _=word(tl, d) /*process each of the words in the TL. */ |
||
if d==1 then w=max(10, length(@._) ) /*use length of the first number used. */ |
|||
say right(@@._, 40) right(commas(tops), wr) right(commas(@._), w) |
say right(@@._, 40) right(commas(tops), wr) right(commas(@._), w) |
||
@._=0 /*nullify this word count for next time*/ |
@._=0 /*nullify this word count for next time*/ |
||
Line 326: | Line 328: | ||
{{out|output|text= when using the default inputs:}} |
{{out|output|text= when using the default inputs:}} |
||
<pre> |
<pre> |
||
23,414 words found in 67,663 records read from the file: les_mes.TXT |
|||
⚫ | |||
⚫ | |||
word rank count |
|||
════ ══════ ═══════ |
|||
the 1 41,088 |
|||
of 2 19,949 |
|||
and 3 14,942 |
|||
a 4 14,595 |
|||
to 5 13,950 |
|||
in 6 11,214 |
|||
he 7 9,607 |
|||
was 8 8,620 |
|||
⚫ | |||
⚫ | |||
</pre> |
</pre> |
||
To see a list of the top 1,000 words that show (among other things) words like '''it's''' and other accented words, see the discussion page. <br><br> |
To see a list of the top 1,000 words that show (among other things) words like '''it's''' and other accented words, see the discussion page. <br><br> |