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");
|
||||
40
Task/Textonyms/jq/textonyms-1.jq
Normal file
40
Task/Textonyms/jq/textonyms-1.jq
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
def textonym_value:
|
||||
gsub("a|b|c|A|B|C"; "2")
|
||||
| gsub("d|e|f|D|E|F"; "3")
|
||||
| gsub("g|h|i|G|H|I"; "4")
|
||||
| gsub("j|k|l|J|K|L"; "5")
|
||||
| gsub("m|n|o|M|N|O"; "6")
|
||||
| gsub("p|q|r|s|P|Q|R|S"; "7")
|
||||
| gsub("t|u|v|T|U|V"; "8")
|
||||
| gsub("w|x|y|z|W|X|Y|Z"; "9");
|
||||
|
||||
def explore:
|
||||
# given an array (or hash), find the maximum length of the items (or values):
|
||||
def max_length: [.[] | length] | max;
|
||||
|
||||
# The length of the longest textonym in the dictionary of numericString => array:
|
||||
def longest:
|
||||
[to_entries[] | select(.value|length > 1) | .key | length] | max;
|
||||
|
||||
# pretty-print a key-value pair:
|
||||
def pp: "\(.key) maps to: \(.value|tostring)";
|
||||
|
||||
split("\n")
|
||||
| map(select(test("^[a-zA-Z]+$"))) # select the strictly alphabetic strings
|
||||
| length as $nwords
|
||||
| reduce .[] as $line
|
||||
( {};
|
||||
($line | textonym_value) as $key
|
||||
| .[$key] += [$line] )
|
||||
| max_length as $max_length
|
||||
| longest as $longest
|
||||
| "There are \($nwords) words in the Textonyms/wordlist word list that can be represented by the digit-key mapping.",
|
||||
"They require \(length) digit combinations to represent them.",
|
||||
"\( [.[] | select(length>1) ] | length ) digit combinations represent Textonyms.",
|
||||
"The numbers mapping to the most words map to \($max_length) words:",
|
||||
(to_entries[] | select((.value|length) == $max_length) | pp ),
|
||||
"The longest Textonyms in the word list have length \($longest):",
|
||||
(to_entries[] | select((.key|length) == $longest and (.value|length > 1)) | pp)
|
||||
;
|
||||
|
||||
explore
|
||||
9
Task/Textonyms/jq/textonyms-2.jq
Normal file
9
Task/Textonyms/jq/textonyms-2.jq
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
$ jq -R -r -c -s -f textonyms.jq textonyms.txt
|
||||
There are 13085 words in the Textonyms/wordlist word list that can be represented by the digit-key mapping.
|
||||
They require 11932 digit combinations to represent them.
|
||||
661 digit combinations represent Textonyms.
|
||||
The numbers mapping to the most words map to 15 words:
|
||||
27 maps to: ["AP","AQ","AR","AS","Ar","As","BP","BR","BS","Br","CP","CQ","CR","Cr","Cs"]
|
||||
The longest Textonyms in the word list have length 11:
|
||||
26456746242 maps to: ["Anglophobia","Anglophobic"]
|
||||
24636272673 maps to: ["CinemaScope","Cinemascope"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue