Auto Tags
Author Sur
License MIT
Homepage http://expressica.com/auto_tags
Mailing List auto_tags@googlegroups.com
Introduction
AutoTags, an open source project, is a plugin for RubyOnRails applications to automatically generate the relevant tags for the provided content by making use of the Yahoo term extraction api. Its quite simple to use and provide easy integration with ActiveRecord. The plugin is very useful for social applications, community websites and all those networking applications where there is a scope of user generate content to be tagged. No more heck for the admin to sit and add the tags to the content or waiting for the users to add the tags to their content.
Installation
Install the plugin by issuing the following command from your rails application root
Usage & Examples
The plugin is quite simple to use and provides direct integration with ActiveRecord’s model classes.
Here are the different examples for different use cases…
In our model classes you just need to specify the method names that should be called to gather the content out of which you need to generate the tags.
NOTE: Yahoo restricts the api usage for 5000 requests in 24 hours from a single IP. So, if your requests goes beyond that, you will get an empty array.
Example including single attribute
Example including multiple attributes
Example including associated attributes
Now, after adding the directive auto_tags as explained above… you will get a method with the model’s object to fetch the relevant tags automatically as…
Integrating with acts_as_taggable
The method get_auto_tags returns the array of relevant tags based upon the content provided through the model.
This can further be used with the acts_as_taggable simply like this…
which can also be automated within the model using the before save callback as…
Example automating with callback
which will automatically updates the tags if the user adds new data.
Recommend
If you liked the plugin then please recommend me on workingwithrails.
Any issue/comment are welcome on the mailing list auto_tags@googlegroups.com.
3 Comments to "Auto Tags"
Please share your thoughts
Filed in: generic


Found a little bug in the readme:
AutoTags::AutoTagsGenerator.generate_tags(content)
should be:
AutoTags::AutoTagsGeneration.generate_tags(content)
Hi Andreas,
Thanks for pointing that out.
Fixed!
It’s also worth mentioning that this code (as all the other ones floating around) based on YTE are only working properly with English text. Other languages are not supported. There are other services out there that do that, but Yahoo! is English-only. Everything else ends up being gibberishy tags.
-J