Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
20
Task/Textonyms/Sidef/textonyms.sidef
Normal file
20
Task/Textonyms/Sidef/textonyms.sidef
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
var words = ARGF.grep(/^[[:alpha:]]+\z/);
|
||||
|
||||
var dials = words.group_by {
|
||||
.tr('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
'2223334445556667777888999922233344455566677778889999');
|
||||
}
|
||||
|
||||
var textonyms = dials.grep_v { .len > 1 };
|
||||
|
||||
say <<-END;
|
||||
There are #{words.len} words which can be represented by the digit key mapping.
|
||||
They require #{dials.len} digit combinations to represent them.
|
||||
#{textonyms.len} digit combinations represent Textonyms.
|
||||
END
|
||||
|
||||
say "Top 5 in ambiguity:";
|
||||
say textonyms.sort_by { |_,v| -v.len }.first(5).join("\n");
|
||||
|
||||
say "\nTop 5 in length:";
|
||||
say textonyms.sort_by { |k,_| -k.len }.first(5).join("\n");
|
||||
Loading…
Add table
Add a link
Reference in a new issue