Guest User

Untitled

a guest
Mar 2nd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. class String
  2. @@words = File.open("dictionary").read.split
  3.  
  4. def self.words
  5. @@words
  6. end
  7.  
  8. def is_word?
  9. @@words.include? self
  10. end
  11.  
  12. def qwerty_to_colemak
  13. self.downcase.tr("qwertyuiopasdfghjkl;zxcvbnm", "qwfpgjluy;arstdhneiozxcvbkm")
  14. end
  15.  
  16. def qwerty_to_dvorak
  17. self.downcase.tr("qwertyuiopasdfghjkl;zxcvbnm,./", "',.pyfgcrlaoeuidhtns;qjkxbmwvz")
  18. end
  19. end
  20.  
  21. String.words.each do |word|
  22. next if word.length < 5
  23. colemak_word = word.qwerty_to_colemak
  24. p [word, colemak_word] if colemak_word.is_word?
  25. end
Add Comment
Please, Sign In to add comment