Trying to write a lite Rails version of Yahoo Shortcuts or something similiar.

Has anyone ever seen Yahoo Shortcuts or something similiar? I would like to write my own in Rails, but I'm not sure the best approach... or is there something already out there that I've missed?

The story goes I have a list of site specific keywords I would like to compare my other site content with. As the page loads the content I would like to do a comparison- basically parse over the text and if there is a match with a keyword then I can create a connection and link.

Right now, I am using Hpricot along with Prototip.js. I've been manually wrapping keywords using a span tag along with attributes within the data to test:

<% doc = Hpricot("#{e.description}") %> <% (doc/"//span").each do |span| %> <% set_record_type = span.attributes["record_type"] rescue nil %> <style> #<%= span.attributes["id"] %>{ font-size: 12px; color: dodgerblue; } </style> <script type='text/javascript'> //<![CDATA[ new Tip('<%= span.attributes["id"] %>', { ajax: { url: '/<%= set_record_type %>/prototip/<%= span.attributes["record_id"] %>', options: { onComplete: function(){ //alert('ajax content loaded'); } } }, effect: 'appear' }); //]]> </script> <% end %>

If I hit a match I underline the term then I drop in some Prototip code to load up a show in my controller.

I'm wondering if there is a better approach. I thought about putting the keywords in an XML file and parsing through that instead to improve performance, but I'm not quite sure how to cache XML in Rails or if that would be helpful.