February 18, 2006

Tag, you’re it!

We were out the whole day yesterday and so I didn’t get to make my usual blog entry. Because of this, I now have two blog entries queued. Yes, I could make them both today but I’m OCD-ness just wouldn’t permit me to do that – so here’s yesterday’s entry and today’s entry will appear tomorrow :p

I put sprucing up Blog on hold for a bit to do some investigating day before yesterday. I wanted to see how good Yahoo Content Analysis Web Services was when it came to getting keywords for a blog entry. I didn’t want to write any code of my own and so I settled on the Terms2posts plugin from Semiologic instead. Unfortunately, the plugin wouldn’t work out of the box and I had to do some debugging to first find out what was wrong. I did find what was going on and managed to get the plugin working but was not satisfied with the keywords that Yahoo returned – it had stuff like "unfortunately" and "ugh" (I say "ugh" a lot :p) and that just didn’t look appealing to me 🙂

So I turned my attention towards Tagyu. They have an API that developers can use to get suggested tags for a given post and I wanted to see how well that works. I quickly hacked the Terms2post plugin and added a function into it that would fetch posts from Tagyu by using some code that the Ultimate Tag Warrior plugin (UTW) used. This seemed to be just my day for non-working code because that bit of code wouldn’t work either :p I went through some debugging and discovered why tagyu tag fetching didn’t work, got it working and finally got some suggestions for my test post. I was actually happy with what I got this time. So I decided that Tagyu was the way to go.

Now came the difficult part. I needed a way to automatically tag posts in WordPress when they were published because I wouldn’t have categories working via XMLRPC for a while longer and I’m not known to be a patient man :p So I needed tagging working easily now, damn it! I decided to write a new WP plugin which would be an add-on to UTW and would simply get suggested tags for any new post and add the suggestions automatically to the UTW tables, giving me an automated tagger 🙂 After a couple of hours of tinkering with code, I actually had the plugin working – at least the base functionality. I’ve also added an admin menu which currently does not have any options (the options are there the admin screen just does not display or save any of it – they are hardcoded at the moment :p). The admin menu also has a button to populate all posts without tags in the blog with tags automatically but I haven’t finished this functionality either. I first want to check out the base functionality in a production environment and then I’ll get the rest working. So here goes ….

Tags: ,
Posted by Fahim at 7:12 am  |  4 Comments