Textonyms: Difference between revisions
Content deleted Content added
m →{{header|Perl 6}}: remove unneeded case insensitivity |
→{{header|Perl 6}}: much faster version |
||
Line 300:
=={{header|Perl 6}}==
<lang perl6>my $src = 'unixdict.txt';
my @c2d = 0 xx 64, @$_, @$_
given '02223334445556667777888999900000'.comb;
my @words = slurp($src).lines.grep(/ ^ <alpha>+ $ /);
my @dials = @words.classify: { @c2d[.ords].join }
my @
say qq:to 'END';
There are {+@words} words in $src which can be represented by the digit key mapping.
They require {+@dials} digit combinations to represent them.
{+@
END
say "Top 5 in ambiguity:";
say " ",$_ for @
say "\nTop 5 in length:";
say " ",$_ for @
{{out}}
<pre>There are 24978 words in unixdict.txt which can be represented by the digit key mapping.
|