Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
frequency counter plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
unlisted committed May 6, 2012
1 parent 586dd1c commit d7d68f3
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lib/DDG/Goodie/Frequency.pm
@@ -0,0 +1,29 @@
package DDG::Goodie::Frequency;
# ABSTRACT: Displays frequency of each character

use DDG::Goodie;

triggers start => 'frequency';

handle remainder => sub {
if ($_)
{
my %freq;

my $lower = lc;
my @chars = split //,$lower;

foreach my $char (@chars)
{
++$freq{$char} unless $_ eq ' ';
};

return "FREQUENCY: " . keys %freq if $_;
};

return;
};

zci is_cached => 1;

1;

0 comments on commit d7d68f3

Please sign in to comment.