Created
July 4, 2011 23:30
-
-
Save anujluthra/1064054 to your computer and use it in GitHub Desktop.
Pull out aboriginal words and their meaning from http://www.grandpapencil.net/austral/abword/
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
require 'hpricot' | |
require 'open-uri' | |
dictionary = {} | |
for letter in ('a'..'z').to_a do | |
begin | |
puts "building dictionary for all: #{letter}" | |
doc = Hpricot(open("http://www.grandpapencil.net/austral/abword/ab#{letter}.htm")) | |
doc.search("li").search("div").each do |elem| | |
word = elem.search("font").first.search("strong").inner_html | |
meaning = elem.search("font").last.inner_html.split("\n").last.strip | |
dictionary[word] = meaning | |
end | |
rescue Exception => e | |
puts "Not found : #{letter}" | |
end | |
end | |
puts "dictionary complete" | |
dictionary.each do |word, meaning| | |
puts "#{word} : #{meaning}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment