Skip to content

Instantly share code, notes, and snippets.

@bastien
Created April 12, 2009 10:58
Show Gist options
  • Save bastien/93958 to your computer and use it in GitHub Desktop.
Save bastien/93958 to your computer and use it in GitHub Desktop.
# 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