Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Find most frequently used word in text file.

by Laurent_R (Prior)
on Dec 19, 2013 at 22:54 UTC ( #1067896=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use strict;
    ...
    print map {$words{$_}, "\t$_\n"} 
          sort {$words{$b} <=> $words{$a} || $a cmp $b} 
          keys %words;
    
  2. or download this
    33093   de
    31980   et
    ...
    9844    des
    9492    d
    [...]
    
  3. or download this
    $words{$_}++ foreach
                map { $_= lc; tr//aaeeeeiiouuc/; $_;}
                grep {length > 2} 
                split /[,.:;"?!'\n ]+/, $texte;
    
  4. or download this
    16774   les
    10103   qui
    ...
    1517    plus
    1513    celui
    1474    fait
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1067896]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2015-07-03 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls