RosettaCodeData/Task/Textonyms/Arturo/textonyms.arturo
2026-02-01 16:33:20 -08:00

27 lines
669 B
Text

words: read.lines relative "unixdict.txt" | select => [match? & {/^[a-z]+$/}]
nums: "22233344455566677778889999"
phone: $ => [
join map &'c -> nums\[sub to :integer c 97]
]
textonyms: #[]
tcount: 0
loop words 'w [
p: phone w
switch key? textonyms p [
textonyms\[p]: textonyms\[p] ++ w
if 2 = size textonyms\[p] -> 'tcount + 1
]
-> textonyms\[p]: @[w]
]
print ~{
There are |size words| words in unixdict.txt which can be represented by the digit key mapping.
They require |size keys textonyms| digit combinations to represent them.
|tcount| digit combinations represent Textonyms.
7325 -> |textonyms\["7325"]|
}