projects

Namey - A Random Name Generator

Recently, I had an idea for a project where I wanted to be able to create random names for people on the fly. It's a fictional schedule for a fictional cable channel, the Not Lifetime Movie Network. Some of the movie titles needed random names. I dug around, and found a few name generators out there, but none of them had an API, or available source code, so I ended up making my own. This quickly turned into a classic project -- I spent maybe an hour or two writing some code to generate a list of fake movies, and ten times longer coming up with a generic library for random name generation. it went something like this:

I don't actually like xkcd that much, but this sums things up nicely.

But when I was done, I had Namey -- a website where you can quickly generate some random names, as well as an underlying library written in ruby. It uses files generated by the US Census Bureau for the 1990 census to generate whatever sort of name you would like. You can pick a gender, specify if you want a last name or not, and if you would like a common name, rare name, etc.

The data itself looks a lot like this (in fact, this is the data):

JAMES 3.318 3.318 1
JOHN 3.271 6.589 2
ROBERT 3.143 9.732 3
MICHAEL 2.629 12.361 4
WILLIAM 2.451 14.812 5
DAVID 2.363 17.176 6
RICHARD 1.703 18.878 7
CHARLES 1.523 20.401 8
JOSEPH 1.404 21.805 9
THOMAS 1.380 23.185 10

So, the government is big on ALL CAPS. Also, there's no punctuation, so O'Brian is OBRIAN. I've done a bunch of massaging to the data - names are mostly in proper case, with apostrophes where it's fairly obvious, but I'm sure I missed some.

For nerds, the code is open source and available on github, so you can fork it and play around as much as you want. As I worked on this project, I developed certain goals:

  • Write a decent Ruby gem to generate random names -- this is the bulk of the project
  • Build a website which can use it -- see http://namey.muffinlabs.com/
  • Play with Twitter's bootstrap library -- I built the website with it. It's pretty cool!
  • Generate a Javascript API layer in between. If you wanted to, you could pull the JS onto your own site and generate random names. Still working on this part.

In short, by the time I'm done, I intend to have a ridiculously overbuilt system for generating random names.

Tags: 

Chatterbot Updated

I've just pushed a new version of Chatterbot with a few main changes:

  • When doing searches, it no longer includes retweets. I struggled with making this change but eventually I decided it makes sense. Several people have told me that they are annoyed when they retweet something which triggers one of my bots. And I can tell from watching the logs for my bots that people who RT someone else don't really expect anything to come of it. So, no more retweets by default. You can still include them explicitly by adding 'include:retweets' in a search string.
  • A nifty new chatterbot-registerscript, which will walk you through the Twitter authorization process, and removes the need to generate any sort of config file yourself. In fact, you don't even need to create a bot first -- the script will output a skeleton bot for you once the authorization is complete.
  • A new script with some pretty basic reporting. Run chatterbot-status to get some output of recent tweets from your bots, and totals for the last 1/7/30 days.
  • Some other cleanup and bug fixes.

Tags: 

Pages

Subscribe to RSS - projects