Skip to content

Instantly share code, notes, and snippets.

@mvr
Created March 7, 2009 12:09
Show Gist options
  • Save mvr/75313 to your computer and use it in GitHub Desktop.
Save mvr/75313 to your computer and use it in GitHub Desktop.
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