Skip to content

Instantly share code, notes, and snippets.

@vyder
Created January 25, 2013 19:18
Show Gist options
  • Select an option

  • Save vyder/4637034 to your computer and use it in GitHub Desktop.

Select an option

Save vyder/4637034 to your computer and use it in GitHub Desktop.
Returns a dictionary hash built from the system dictionary.
def build_dictionary
# from http://stackoverflow.com/a/3480849/834459
dictionary = {}
File.open("/usr/share/dict/words") do |file|
file.each do |line|
dictionary[line.strip] = true
end
end
return dictionary
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment