Posts Tagged ‘api’

Wordnik Gem

Posted: 12 March 2010 in Uncategorized
Tags: , , , , ,

Erin McKean

I’ve had my eye on Wordnik for a while, since finding out the excellent lexicographer Erin McKean co-founded it.  Wordnik is the most comprehensive dictionary in the known universe.  Srsly!

They released an API a few months ago and I quickly threw together a gem wrapping it, based on HTTParty.  Tonight I updated the gem for version 3 of the API and simplified it to just a single class with the bare essentials.  You can perform pretty much all of the API calls and get a hash of the results.  It’s nothing major, but will give you a chance to play around with the Wordnik API with almost no work on your part (aside from getting yourself a key).  This change breaks backwards compatibility completely, sorry.

Example usage:

w = Wordnik.new("YOUR_API_KEY")
w.define('gem') # => big hash with all the definitions
w.examples('gem') # => example sentences using "gem"

You can grab the gem off of RubyGems or you can take a look at the source on github.  As always, please let me know if you encounter any problems.

Advertisements

Earlier today, I was checking out the suggested connections provided by re-searchr (by James Ostheimer, @jostheim).  A discussion arose around ranking suggested users and potentially using a measure like TunkRank as a part of that ranking.  The prospect of James having to reimplement TunkRank encouraged me to implement a part of the TunkRank API I had been planning for a while:  fetching a user’s TunkRank score.

Fortunately, Merb is a framework that makes it particularly easy to render a page in different formats without having to add a lot of new code.  The end result is a very simple first step that returns the raw TunkRank score in JSON format.  You can access it via the following RESTful url:

http://tunkrank.com/twitter_users/{username}.json

If the user has not had their TunkRank score calculated yet, the return value will be 0, otherwise it will be a number greater than or equal to one. New users are added to a queue and are ranked at various points throughout the day when usage is low. It’s on my TODO list to make this happen more frequently. I can only blame its neglect on forgetfulness.

Daniel already has a write-up on this fledgling API. I’ve been busy watching the first week of In Treatment on DVD — a show that is turning out to be very intriguing. I realize that has nothing to do with the rest of the post, but I liked the show so much I had to tell someone. :)

The Road Ahead for TunkRank

Posted: 6 March 2009 in Uncategorized
Tags: , , , ,

Now that TunkRank has gone live, I am faced with some interesting choices.

First of all, I want to make the code open source. The only barrier to my doing that is that I have passwords saved in version control that really can’t be shared with the outside world. I didn’t even think about that being an issue until I was actually deploying it and saw someone mention it in a blog tutorial. There are ways of getting around this problem, and I’ll have to look into them before I can do it.

Next is the issue of expanding the size of the explored social graph. Right now I have found about 2 million users and know the followers of 500 thousand of those. When I was doing everything in memory, it was very fast for me to expand it and relatively easy to merge them. Now I am using a database (MySQL) and doing operations on it for the social graph are just not fast. So I need something better.

Also, I want to make the TunkRank scores available as a data set or at least via an API, so I need to look into ways of doing that. Merb makes it pretty easy to deliver results as xml or json — I just have to get around to doing it. Right now you can find user jimbob’s TunkRank score either by entering “jimbob” in the search box on the main page or by going to the URL http://tunkrank.com/score/jimbob. Extracting it via json or xml will be just a matter of going to http://tunkrank.com/score/jimbob.format.

I need to provide additional scoring systems other than TunkRank, so that TunkRank can be compared. I’m not sure whether this isn’t something better served by just providing the data set and letting people play around in their own database or if I should provide alternate views. The former is more versatile, the latter will probably reach a larger audience.

Currently I show Google ads on TunkRank, mainly because I have spent a small amount of money on it and wouldn’t mind getting that back. If it starts making any real kind of money, that probably means the traffic has increased significantly and I will need to look at hosting it on EC2 or somewhere. I have no illusions that TunkRank will make me rich. I expect it will make me literally tens of dollars … poorer. :)

Finally, there is the issue of the score I display. I chose to show the percentile ranking because it’s easy to see where you are in comparison to other twitter users. If I just showed you the raw TunkRank score, you would have no frame of reference. My solution was to show you both. The downside is it groups all the “interesting” users into the top three percentiles. @NealRichter has put some thought into this, and I urge you to check out his post, leave some comments and help come up with a scoring mechanism that offers better granularity and yet lets you easily compare yourself to the rest of the world. Thus completes today’s desperate plea for crowdsourcing.