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: Coding, WordPress
Posted by Fahim at 7:12 am   Comments (4)

4 Responses to Tag, you’re it!

Subscribe to comments with RSS

#1
Gravatar Image
Berry 19 February 2006 at 9:10 pm

Hi! I ran into the same problem: fetching suggested keywords doesn’t work. I get errors like ‘you’re requesting too often’, ‘no suggestions’ or no reaction at all. But you seem to have hard coded a proper solution. Care to share it with the rest of us? I’d be very thankful!

#2
Gravatar Image
Denis de Bernardy 18 February 2006 at 8:50 pm

Yeah… Yahoo!’s content analysis tool doesn’t sprout very relevant results. Would you mind sending me a description of the problems you encountered with terms2post by email?

[…] Tag, you’re it! […]

#4
Gravatar Image
Fahim 20 February 2006 at 7:07 am

The UTW issue could have been one of several things, I made quite a few changes to the script but have shared it with Christine so that the changes should make it to a new release of UTW 🙂 The biggest issue was that the UTW parser was looking for the string “<tag>” in the returned results from tagyu.com but they seemed to have changed their return results at some point and had added other attributes to the tag so that UTW should actually have been looking for “<tag”. I made that change and also added support for authentication at tagyu.com since otherwise I believe they limit you to one query per minute ot something. If anybody wants the changed code, I can always e-mail it to you 🙂

Leave a response

:mrgreen: :neutral: :twisted: :shock: :smile: :???: :cool: :evil: :grin: :oops: :razz: :roll: :wink: :cry: :eek: :lol: :mad: :sad: