Textonyms: Difference between revisions

Content added Content deleted
(→‎OCaml: add)
(added Arturo)
Line 271: Line 271:
3532876362374256472749 encodes electroencephalography
3532876362374256472749 encodes electroencephalography
</pre>
</pre>

=={{header|Arturo}}==

<syntaxhighlight lang="arturo">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
if? key? textonyms p [
textonyms\[p]: textonyms\[p] ++ w
if 2 = size textonyms\[p] -> 'tcount + 1
]
else -> 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"]|
}<syntaxhighlight>

{{out}}

<pre>There are 24978 words in unixdict.txt which can be represented by the digit key mapping.
They require 22903 digit combinations to represent them.
1473 digit combinations represent Textonyms.

7325 -> [peak peal peck real reck seal]</pre>


=={{header|C}}==
=={{header|C}}==