Posted By

fatribz on 10/07/10


Tagged

words python rhymes raps


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

gartenstuhl


Find rhyming words


 / Published in: Python
 

needs external library lxml

  1. import urllib
  2. from lxml.html import fromstring
  3.  
  4. def getRhymes(word):
  5. url = 'http://www.rhymer.com/RhymingDictionary/%s.html' % word
  6. doc = fromstring(urllib.urlopen(url).read())
  7. for i in doc.find_class('blue'):
  8. items = i.xpath('tr/td/a')
  9. return [hmm.text for hmm in items]

Report this snippet  

You need to login to post a comment.