[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [LOCALE] Hjælp til frekvensanalyse



Ole Laursen <sslug@sslug> writes:

> Hver tegnfølge skal altså være sorteret for sig efter hyppigheden i
> almindelig dansk tastaturinput (dvs. ikke Perl- eller C-kode :-).

Har du et korpus over hvad du mener er almindelig dansk tastaturinput?

perl -nle '$a++, $f{$_}++ for (split//); END{print "$_: ", $f{$_}/$a
for sort { $f{$b} <=> $f{$a} } keys %f}' 

Eller:

#!/usr/bin/perl
$/ = "\n"; $\ = "\n";
LINE: while (defined($_ = <ARGV>)) {
    chomp $_;
    foreach $_ (split(//, $_, 0)) {
        ++$a, ++$f{$_};
    }
}

foreach $_ (sort {$f{$b} <=> $f{$a};} keys %f) {
    print "${_}: ", $f{$_} / $a;
}
__END__


-- 
 Peter Makholm     |    I congratulate you. Happy goldfish bowl to you, to
 sslug@sslug |      me, to everyone, and may each of you fry in hell
 http://hacking.dk |                                               forever
                   |                                      -- The Dead Past


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:54 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *