Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Textonyms/Ruby/textonyms.rb
Normal file
11
Task/Textonyms/Ruby/textonyms.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
NUMS = "22233344455566677778889999" * 2
|
||||
dict = "unixdict.txt"
|
||||
|
||||
textonyms = File.open(dict){|f| f.map(&:chomp).group_by {|word| word.tr(CHARS, NUMS) } }
|
||||
|
||||
puts "There are #{File.readlines(dict).size} words in #{dict} which can be represented by the digit key mapping.
|
||||
They require #{textonyms.size} digit combinations to represent them.
|
||||
#{textonyms.count{|_,v| v.size > 1}} digit combinations represent Textonyms."
|
||||
|
||||
puts "\n25287876746242: #{textonyms["25287876746242"].join(", ")}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue