Posts Tagged ‘python’

Jabber Chat Bot Dictionary Service

September 23, 2008

Ever since I wrote this, I wanted an chat bot which would respond to messages and provide some service. One of my most desired service was to fetch word definitions. An avid user of Google’s define keyword search, I wanted it on a chat window.

Got some free time today and whipped up a dictionary service. With free libraries like xmpppy, pywordnet etc, writing the service was very easy.

Steps:

  1. Created a GMail Id to use as a Jabber Id
  2. Install xmppy and python-jabberbot which is a wrapper over xmpppy which makes it very easy to plug into a Jabber service
  3. Install WordNet for dictionary database
  4. Install PyWordNet which is a python interface for WordNet database
  5. Implement a method starting with bot_ e.g.  ‘bot_define’ so that when the user runs enters ‘define <word>, this method would be invoked and the meanings returned. See python-jabberbot link for more info.

Planning to extend this to put in more services.

Advertisements

Checking out Google App Engine

May 2, 2008

I finally sat down to play around with Google’s App Engine a couple of days back and the first thing that strikes you is how easy it is!

Taking the idea from Swaroop CH’s Productive Home Page, I wrote a small Start Page app where you can configure your favorite links for easy access. It hardly took an hour to write the code itself and the most time consuming part was getting an App name (“istartpage” in my case) because the good app names were already taken!

 

istartpage_ss

The SDK is very easy to work with and even simulates a login interface if you plan to use the Google Accounts sign-on for your app. But I found the template engine a little difficult to use. Rather than using built-in tags, why not allow just plain Python code in a template like it is in JSP‘s in Java .

App Engine provides a dashboard for your app where you can view/filter logs, view/delete table data etc.

All in all, a good platform to create hobby apps.

Get scores of Indian cricket matches on twitter

March 29, 2008

I wrote a script to fetch the scores from CricInfo‘s Live RSS feed and post messages to Twitter everytime the score changes.

You can get scores by following indiablues on Twitter.

The code is available here .

UPDATE: Inspired by baggygreen and meninblue, I wrote another script to scrape the comments of off CricInfo’s famous ball-by-ball commentary using BeautifulSoup and post it to Twitter using their API. The only difference is that, I post only the comments mentioning boundaries or Sixes or Outs. Getting all commentary is boring. Anyways, the code is available here.