Archive for December, 2010

Get your Wu-name in six lines of Python

I recently had a need to generate screen-names for a bunch of test users. I remembered the wonderful Wu-name generator and it was too tempting to pass up.

import urllib
from lxml.html import fromstring
def get_wu_name(first_name, last_name):
    """
    >>> get_wu_name("Jeff", "Elmore")
    'Ultra-Chronic Monstah'
    """
    w = urllib.urlopen("http://www.recordstore.com/wuname/wuname.pl",
                       urllib.urlencode({'fname':first_name, 'sname': last_name}))
    doc = fromstring(w.read())
    return [d for d in doc.iter('span') if d.get('class') == 'newname'][0].text

Okay, technically it’s more than six if you count the docstring and linewrap but still. Also, I felt like there should be a better way to do the last line, but this works well enough.


Twitter-feed

  • @jaidevd basically my hunch is some of those techniques could be powerful when applied to more specific problems in literacy research 4 months ago
  • @jaidevd also doesn't have to be deep learning but any modern ML like Parsey McParseface with TensorFlow 4 months ago
  • @jaidevd I'm interested in variations on that theme I think like doc2vec or other representations for different specific problems 4 months ago
  • @jaidevd I've mostly been using precalculated vectors from word2vec and glove 4 months ago
  • @jaidevd just trying to get a lay of the land basically. Seems like lots of opportunities for new NLP approaches these days. 4 months ago