Jump to content

Word frequency: Difference between revisions

→‎{{header|Raku}}: Demonstrate general use capability
m (→‎version 1: changed whitespace, added wording, and highlighting.)
(→‎{{header|Raku}}: Demonstrate general use capability)
Line 2,804:
that 7825
it 6535</pre>
 
One nice thing is this isn't special cased. It will work out of the box for any text / language.
 
[https://www.gutenberg.org/files/14741/14741-0.txt Russian]? No problem.
 
<pre>$ raku wf 14741-0.txt 5</pre>
<pre>Top 5 using regex: rx/ <[a..z]>+ /
the 176
of 119
gutenberg 93
project 87
to 80
 
Top 5 using regex: rx/ \w+ /
и 860
в 579
не 290
на 222
ты 195
 
Top 5 using regex: rx/ <[\w]-[_]>+ /
и 860
в 579
не 290
на 222
ты 195
 
Top 5 using regex: rx/ <[\w]-[_]>+[["'"|'-'|"'-"]<[\w]-[_]>+]* /
и 860
в 579
не 290
на 222
ты 195</pre>
 
[https://www.gutenberg.org/files/39963/39963-0.txt Greek]? Sure, why not.
<pre>$ raku wf 39963-0.txt 5</pre>
<pre>Top 5 using regex: rx/ <[a..z]>+ /
the 187
of 123
gutenberg 93
project 87
to 82
 
Top 5 using regex: rx/ \w+ /
και 1628
εις 986
δε 982
του 895
των 859
 
Top 5 using regex: rx/ <[\w]-[_]>+ /
και 1628
εις 986
δε 982
του 895
των 859
 
Top 5 using regex: rx/ <[\w]-[_]>+[["'"|'-'|"'-"]<[\w]-[_]>+]* /
και 1628
εις 986
δε 982
του 895
των 859</pre>
 
Of course, for the first matcher, we are asking specifically to match Latin ASCII, so we end up with... well... Latin ASCII; but the other 3 match any Unicode characters.
 
=={{header|REXX}}==
10,343

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.