Created
March 7, 2009 12:09
-
-
Save mvr/75313 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
@@words = File.open("dictionary").read.split | |
def self.words | |
@@words | |
end | |
def is_word? | |
@@words.include? self | |
end | |
def qwerty_to_colemak | |
self.downcase.tr("qwertyuiopasdfghjkl;zxcvbnm", "qwfpgjluy;arstdhneiozxcvbkm") | |
end | |
def qwerty_to_dvorak | |
self.downcase.tr("qwertyuiopasdfghjkl;zxcvbnm,./", "',.pyfgcrlaoeuidhtns;qjkxbmwvz") | |
end | |
end | |
String.words.each do |word| | |
next if word.length < 5 | |
colemak_word = word.qwerty_to_colemak | |
p [word, colemak_word] if colemak_word.is_word? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment