Created
April 12, 2009 10:58
-
-
Save bastien/93958 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
# Given a chinese character, fetch its ethymology through http://www.internationalscientific.org/ | |
# | |
require 'rubygems' | |
require 'open-uri' | |
require 'hpricot' | |
require 'cgi' | |
def get_ethymology(chinese) | |
doc = Hpricot(open("http://www.internationalscientific.org/CharacterASP/CharacterEtymology.aspx?characterInput=#{ CGI.escape(chinese) }")) | |
return doc.search("#charEty").inner_html | |
end | |
puts get_ethymology("携") | |
# here you go. Thanks Richard Sears for his great chinese ethymology website. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment